Skip to content

Commit c80c5d9

Browse files
committed
Goodbye, bad whitespace
1 parent f929659 commit c80c5d9

32 files changed

+203
-217
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ $ rails generate couchrest_model:config
101101
$ rails generate model person --orm=couchrest_model
102102
```
103103

104-
## General Usage
104+
## General Usage
105105

106106
```ruby
107107
require 'couchrest_model'

THANKS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ CouchRest THANKS
22
=====================
33

44
CouchRest was originally developed by J. Chris Anderson <jchris@grabb.it>
5-
and a number of other contributors. Many people further contributed to
5+
and a number of other contributors. Many people further contributed to
66
CouchRest by reporting problems, suggesting various improvements or submitting
77
changes. A list of these people is included below.
88

@@ -15,7 +15,7 @@ changes. A list of these people is included below.
1515
* [Marcos Tapajós](http://tapajos.me)
1616
* [Sam Lown](http://github.com/samlown)
1717
* [Will Leinweber](http://github.com/will)
18-
18+
1919
Patches are welcome. The primary source for this software project is [on Github](http://github.com/couchrest/couchrest)
2020

2121
A lot of people have active forks - thank you all - even the patches I don't end up using are helpful.

benchmarks/dirty.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
class BenchmarkCasted < Hash
1010
include CouchRest::Model::CastedModel
11-
11+
1212
property :name
1313
end
1414

@@ -86,11 +86,11 @@ def run_benchmark
8686
if ENV['BENCHMARK_DB']
8787
# db writing
8888
x.report("write changed record to db") do
89-
db_n.times { |i| b.string = "test#{i}"; b.save }
89+
db_n.times { |i| b.string = "test#{i}"; b.save }
9090
end
9191

9292
x.report("write unchanged record to db") do
93-
db_n.times { b.save }
93+
db_n.times { b.save }
9494
end
9595

9696
# db reading

history.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@
3232
* Support typecasting `Symbol`
3333
* Added `:array` option to properties
3434
* Typecasting Dates, Times, and Booleans, with invalid values returns nil
35-
35+
3636
* API Breaking Changes
3737
* Properties with blocks are now singular unless the `array: true` option is passed.
38-
38+
3939

4040
## 1.2.0.beta - 2012-06-08
4141

@@ -163,7 +163,7 @@ Notes:
163163
## CouchRest Model 1.0.0.beta8
164164

165165
* Major enhancements
166-
* Added model generator
166+
* Added model generator
167167

168168
* Minor enhancements
169169
* Raise error on adding objects to "collection_of" without an id

lib/couchrest/model/associations.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module Model
33
module Associations
44

55
# Basic support for relationships between CouchRest::Model::Base
6-
6+
77
def self.included(base)
88
base.extend(ClassMethods)
99
end
@@ -15,14 +15,14 @@ module ClassMethods
1515
# An attribute will be created matching the name of the attribute
1616
# with '_id' on the end, or the foreign key (:foreign_key) provided.
1717
#
18-
# Searching for the assocated object is performed using a string
18+
# Searching for the assocated object is performed using a string
1919
# (:proxy) to be evaulated in the context of the owner. Typically
2020
# this will be set to the class name (:class_name), or determined
2121
# automatically if the owner belongs to a proxy object.
2222
#
2323
# If the association owner is proxied by another model, than an attempt will
2424
# be made to automatically determine the correct place to request
25-
# the documents. Typically, this is a method with the pluralized name of the
25+
# the documents. Typically, this is a method with the pluralized name of the
2626
# association inside owner's owner, or proxy.
2727
#
2828
# For example, imagine a company acts as a proxy for invoices and clients.
@@ -32,7 +32,7 @@ module ClassMethods
3232
#
3333
# self.company.clients
3434
#
35-
# If the name of the collection proxy is not the pluralized assocation name,
35+
# If the name of the collection proxy is not the pluralized assocation name,
3636
# it can be set with the :proxy_name option.
3737
#
3838
def belongs_to(attrib, *options)

lib/couchrest/model/base.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Base < CouchRest::Document
1919
include Designs
2020
include CastedBy
2121
include Dirty
22-
22+
2323

2424
def self.subclasses
2525
@subclasses ||= []
@@ -68,13 +68,13 @@ def initialize(attributes = {}, options = {})
6868
alias :new_record? :new?
6969
alias :new_document? :new?
7070

71-
# Compare this model with another by confirming to see
71+
# Compare this model with another by confirming to see
7272
# if the IDs and their databases match!
7373
#
74-
# Camparison of the database is required in case the
74+
# Camparison of the database is required in case the
7575
# model has been proxied or loaded elsewhere.
7676
#
77-
# A Basic CouchRest document will only ever compare using
77+
# A Basic CouchRest document will only ever compare using
7878
# a Hash comparison on the attributes.
7979
def == other
8080
return false unless other.is_a?(Base)

lib/couchrest/model/casted_hash.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ def replace(other_hash)
4444
if use_dirty? && other_hash && other_hash.kind_of?(Hash)
4545
# new keys and changed keys
4646
other_hash.keys.each do |key|
47-
if self[key] != other_hash[key] || !include?(key)
48-
couchrest_attribute_will_change!(key)
47+
if self[key] != other_hash[key] || !include?(key)
48+
couchrest_attribute_will_change!(key)
4949
end
5050
end
5151
# old keys
@@ -70,7 +70,7 @@ def delete_if
7070
super
7171
end
7272

73-
# ruby 1.9
73+
# ruby 1.9
7474
def keep_if
7575
if use_dirty? && block_given?
7676
self.keys.each do |key|

lib/couchrest/model/designs.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ module ClassMethods
3030
# Adding a prefix allows you to associate multiple design documents with the same
3131
# model. This is useful if you'd like to split your designs into seperate
3232
# use cases; one for regular search functions and a second for stats for example.
33-
#
33+
#
3434
# # Create a design doc with id _design/Cats
3535
# design do
3636
# view :by_name
@@ -100,7 +100,7 @@ def prepare_design_options(*args)
100100
end
101101

102102
def prepare_source_paths(options)
103-
103+
104104
end
105105

106106
end

lib/couchrest/model/designs/view.rb

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ module Designs
55
#
66
# A proxy class that allows view queries to be created using
77
# chained method calls. After each call a new instance of the method
8-
# is created based on the original in a similar fashion to ruby's Sequel
8+
# is created based on the original in a similar fashion to ruby's Sequel
99
# library, or Rails 3's Arel.
1010
#
11-
# CouchDB views have inherent limitations, so joins and filters as used in
11+
# CouchDB views have inherent limitations, so joins and filters as used in
1212
# a normal relational database are not possible.
1313
#
1414
class View
@@ -52,15 +52,15 @@ def initialize(design_doc, parent, new_query = {}, name = nil)
5252
# == View Execution Methods
5353
#
5454
# Request to the CouchDB database using the current query values.
55-
55+
5656
# Return each row wrapped in a ViewRow object. Unlike the raw
5757
# CouchDB request, this will provide an empty array if there
5858
# are no results.
5959
def rows
6060
return @rows if @rows
6161
if execute && result['rows']
6262
@rows ||= result['rows'].map{|v| ViewRow.new(v, model)}
63-
else
63+
else
6464
[ ]
6565
end
6666
end
@@ -75,23 +75,23 @@ def all
7575
end
7676

7777
# Provide all the documents from the view. If the view has not been
78-
# prepared with the +include_docs+ option, each document will be
78+
# prepared with the +include_docs+ option, each document will be
7979
# loaded individually.
8080
def docs
8181
@docs ||= rows.map{|r| r.doc}
8282
end
8383

84-
# If another request has been made on the view, this will return
84+
# If another request has been made on the view, this will return
8585
# the first document in the set. If not, a new query object will be
86-
# generated with a limit of 1 so that only the first document is
86+
# generated with a limit of 1 so that only the first document is
8787
# loaded.
8888
def first
8989
result ? all.first : limit(1).all.first
9090
end
9191

9292
# Same as first but will order the view in descending order. This
93-
# does not however reverse the search keys or the offset, so if you
94-
# are using a +startkey+ and +endkey+ you might end up with
93+
# does not however reverse the search keys or the offset, so if you
94+
# are using a +startkey+ and +endkey+ you might end up with
9595
# unexpected results.
9696
#
9797
# If in doubt, don't use this method!
@@ -115,7 +115,7 @@ def length
115115
#
116116
# Trying to use this method with the group option will raise an error.
117117
#
118-
# If no reduce function is defined, a query will be performed
118+
# If no reduce function is defined, a query will be performed
119119
# to return the total number of rows, this is the equivalant of:
120120
#
121121
# view.limit(0).total_rows
@@ -130,7 +130,7 @@ def count
130130
end
131131
end
132132

133-
# Check to see if the array of documents is empty. This *will*
133+
# Check to see if the array of documents is empty. This *will*
134134
# perform the query and return all documents ready to use, if you don't
135135
# want to load anything, use +#total_rows+ or +#count+ instead.
136136
def empty?
@@ -169,7 +169,7 @@ def values
169169
#
170170
# In this example, the raw option will be ignored, and the total rows
171171
# will still be accessible.
172-
#
172+
#
173173
def [](value)
174174
execute[value]
175175
end
@@ -182,8 +182,8 @@ def info
182182

183183

184184
# == View Filter Methods
185-
#
186-
# View filters return a copy of the view instance with the query
185+
#
186+
# View filters return a copy of the view instance with the query
187187
# modified appropriatly. Errors will be raised if the methods
188188
# are combined in an incorrect fashion.
189189
#
@@ -196,10 +196,10 @@ def key(value)
196196
update_query(:key => value)
197197
end
198198

199-
# Find all index keys that start with the value provided. May or may
199+
# Find all index keys that start with the value provided. May or may
200200
# not be used in conjunction with the +endkey+ option.
201201
#
202-
# When the +#descending+ option is used (not the default), the start
202+
# When the +#descending+ option is used (not the default), the start
203203
# and end keys should be reversed, as per the CouchDB API.
204204
#
205205
# Cannot be used if the key has been set.
@@ -208,7 +208,7 @@ def startkey(value)
208208
update_query(:startkey => value)
209209
end
210210

211-
# The result set should start from the position of the provided document.
211+
# The result set should start from the position of the provided document.
212212
# The value may be provided as an object that responds to the +#id+ call
213213
# or a string.
214214
def startkey_doc(value)
@@ -225,19 +225,19 @@ def endkey(value)
225225
update_query(:endkey => value)
226226
end
227227

228-
# The result set should end at the position of the provided document.
229-
# The value may be provided as an object that responds to the +#id+
228+
# The result set should end at the position of the provided document.
229+
# The value may be provided as an object that responds to the +#id+
230230
# call or a string.
231231
def endkey_doc(value)
232232
update_query(:endkey_docid => value.is_a?(String) ? value : value.id)
233233
end
234234

235235
# Keys is a special CouchDB option that will cause the view request to be POSTed
236-
# including an array of keys. Only documents with the matching keys will be
237-
# returned. This is much faster than sending multiple requests for a set
236+
# including an array of keys. Only documents with the matching keys will be
237+
# returned. This is much faster than sending multiple requests for a set
238238
# non-consecutive documents.
239239
#
240-
# If no values are provided, this method will act as a wrapper around
240+
# If no values are provided, this method will act as a wrapper around
241241
# the rows result set, providing an array of keys.
242242
def keys(*keys)
243243
if keys.empty?
@@ -290,16 +290,16 @@ def reduce
290290
# Control whether the reduce function reduces to a set of distinct keys
291291
# or to a single result row.
292292
#
293-
# By default the value is false, and can only be set when the view's
293+
# By default the value is false, and can only be set when the view's
294294
# +#reduce+ option has been set.
295295
def group
296296
raise "View#reduce must have been set before grouping is permitted" unless query[:reduce]
297297
update_query(:group => true)
298298
end
299299

300-
# Will set the level the grouping should be performed to. As per the
300+
# Will set the level the grouping should be performed to. As per the
301301
# CouchDB API, it only makes sense when the index key is an array.
302-
#
302+
#
303303
# This will automatically set the group option.
304304
def group_level(value)
305305
group.update_query(:group_level => value.to_i)
@@ -313,7 +313,7 @@ def include_docs
313313

314314
# Allow the results of a query to be provided "stale". Setting to 'ok'
315315
# will disable all view updates for the query.
316-
# When 'update_after' is provided the index will be update after the
316+
# When 'update_after' is provided the index will be update after the
317317
# result has been returned.
318318
def stale(value)
319319
unless (['ok', 'update_after'].include?(value.to_s))
@@ -433,17 +433,17 @@ def define_and_create(design_doc, name, opts = {})
433433
create_model_methods(design_doc, name, opts)
434434
end
435435

436-
# Simplified view definition. A new view will be added to the
436+
# Simplified view definition. A new view will be added to the
437437
# provided design document using the name and options.
438438
#
439-
# If the view name starts with "by_" and +:by+ is not provided in
439+
# If the view name starts with "by_" and +:by+ is not provided in
440440
# the options, the new view's map method will be interpreted and
441441
# generated automatically. For example:
442442
#
443443
# View.define(Meeting, design, "by_date_and_name")
444444
#
445-
# Will create a view that searches by the date and name properties.
446-
# Explicity setting the attributes to use is possible using the
445+
# Will create a view that searches by the date and name properties.
446+
# Explicity setting the attributes to use is possible using the
447447
# +:by+ option. For example:
448448
#
449449
# View.define(Meeting, design, "by_date_and_name", :by => [:date, :firstname, :lastname])

lib/couchrest/model/embeddable.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def id
5858
def update_attributes_without_saving(hash)
5959
hash.each do |k, v|
6060
raise NoMethodError, "#{k}= method not available, use property :#{k}" unless self.respond_to?("#{k}=")
61-
end
61+
end
6262
hash.each do |k, v|
6363
self.send("#{k}=",v)
6464
end

0 commit comments

Comments
 (0)