aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaco Guzman <fjguzman@aspgems.com>2010-08-12 17:09:58 +0200
committerPaco Guzman <fjguzman@aspgems.com>2010-08-12 17:09:58 +0200
commit8a2b69b7273379f3c9f68ff7903b653801951ac3 (patch)
treed040890da223ef4317981377e83143b7a6934992
parent599c50583784537eec454f5e91dac89f88e54da3 (diff)
downloadrails-8a2b69b7273379f3c9f68ff7903b653801951ac3.tar.gz
rails-8a2b69b7273379f3c9f68ff7903b653801951ac3.tar.bz2
rails-8a2b69b7273379f3c9f68ff7903b653801951ac3.zip
applied guidelines to "# =>"
-rw-r--r--actionmailer/README.rdoc4
-rw-r--r--activemodel/README.rdoc14
-rw-r--r--activerecord/CHANGELOG2
-rw-r--r--activerecord/lib/active_record/autosave_association.rb10
-rw-r--r--activerecord/lib/active_record/reflection.rb2
-rw-r--r--activeresource/README.rdoc34
-rw-r--r--activesupport/CHANGELOG6
-rw-r--r--activesupport/lib/active_support/core_ext/class/attribute.rb12
-rw-r--r--activesupport/lib/active_support/core_ext/class/attribute_accessors.rb4
-rw-r--r--activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb4
-rw-r--r--railties/guides/source/security.textile10
11 files changed, 51 insertions, 51 deletions
diff --git a/actionmailer/README.rdoc b/actionmailer/README.rdoc
index b52c993f56..602326eef7 100644
--- a/actionmailer/README.rdoc
+++ b/actionmailer/README.rdoc
@@ -65,8 +65,8 @@ simply call the method and optionally call +deliver+ on the return value.
Calling the method returns a Mail Message object:
- message = Notifier.welcome #=> Returns a Mail::Message object
- message.deliver #=> delivers the email
+ message = Notifier.welcome # => Returns a Mail::Message object
+ message.deliver # => delivers the email
Or you can just chain the methods together like:
diff --git a/activemodel/README.rdoc b/activemodel/README.rdoc
index 89cacbcab4..73c58a87db 100644
--- a/activemodel/README.rdoc
+++ b/activemodel/README.rdoc
@@ -107,8 +107,8 @@ modules:
extend ActiveModel::Naming
end
- NamedPerson.model_name #=> "NamedPerson"
- NamedPerson.model_name.human #=> "Named person"
+ NamedPerson.model_name # => "NamedPerson"
+ NamedPerson.model_name.human # => "Named person"
{Learn more}[link:classes/ActiveModel/Naming.html]
@@ -139,7 +139,7 @@ modules:
end
Person.human_attribute_name('my_attribute')
- #=> "My attribute"
+ # => "My attribute"
{Learn more}[link:classes/ActiveModel/Translation.html]
@@ -157,7 +157,7 @@ modules:
person = Person.new
person.first_name = 'zoolander'
- person.valid? #=> false
+ person.valid? # => false
{Learn more}[link:classes/ActiveModel/Validations.html]
@@ -176,9 +176,9 @@ modules:
end
p = ValidatorPerson.new
- p.valid? #=> false
- p.errors.full_messages #=> ["Name must exist"]
+ p.valid? # => false
+ p.errors.full_messages # => ["Name must exist"]
p.name = "Bob"
- p.valid? #=> true
+ p.valid? # => true
{Learn more}[link:classes/ActiveModel/Validator.html]
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG
index 20b2286fc0..972c907c46 100644
--- a/activerecord/CHANGELOG
+++ b/activerecord/CHANGELOG
@@ -966,7 +966,7 @@ during calendar reform. #7649, #7724 [fedot, Geoff Buesing]
* Made increment_counter/decrement_counter play nicely with optimistic locking, and added a more general update_counters method [Jamis Buck]
* Reworked David's query cache to be available as Model.cache {...}. For the duration of the block no select query should be run more then once. Any inserts/deletes/executes will flush the whole cache however [Tobias Lütke]
- Task.cache { Task.find(1); Task.find(1) } #=> 1 query
+ Task.cache { Task.find(1); Task.find(1) } # => 1 query
* When dealing with SQLite3, use the table_info pragma helper, so that the bindings can do some translation for when sqlite3 breaks incompatibly between point releases. [Jamis Buck]
diff --git a/activerecord/lib/active_record/autosave_association.rb b/activerecord/lib/active_record/autosave_association.rb
index c661d68869..dc6352ab12 100644
--- a/activerecord/lib/active_record/autosave_association.rb
+++ b/activerecord/lib/active_record/autosave_association.rb
@@ -72,20 +72,20 @@ module ActiveRecord
#
# post = Post.new(:title => 'ruby rocks')
# post.comments.build(:body => 'hello world')
- # post.save #=> will save both post and comment
+ # post.save # => will save both post and comment
#
# post = Post.create(:title => 'ruby rocks')
# post.comments.build(:body => 'hello world')
- # post.save #=> will save both post and comment
+ # post.save # => will save both post and comment
#
# post = Post.create(:title => 'ruby rocks')
# post.comments.create(:body => 'hello world')
- # post.save #=> will save both post and comment
+ # post.save # => will save both post and comment
#
# post = Post.create(:title => 'ruby rocks')
# post.comments.build(:body => 'hello world')
# post.comments[0].body = 'hi everyone'
- # post.save #=> will save both post and comment and comment will have 'hi everyone'
+ # post.save # => will save both post and comment and comment will have 'hi everyone'
#
# In the above cases even without <tt>autosave</tt> option children got updated.
#
@@ -99,7 +99,7 @@ module ActiveRecord
# post = Post.create(:title => 'ruby rocks')
# post.comments.create(:body => 'hello world')
# post.comments[0].body = 'hi everyone'
- # post.save #=> will save both post and comment and comment will have 'hi everyone'
+ # post.save # => will save both post and comment and comment will have 'hi everyone'
#
# Destroying one of the associated models members, as part of the parent's
# save action, is as simple as marking it for destruction:
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb
index 7f47a812eb..8295fd68b3 100644
--- a/activerecord/lib/active_record/reflection.rb
+++ b/activerecord/lib/active_record/reflection.rb
@@ -41,7 +41,7 @@ module ActiveRecord
# Returns the AggregateReflection object for the named +aggregation+ (use the symbol).
#
- # Account.reflect_on_aggregation(:balance) #=> the balance AggregateReflection
+ # Account.reflect_on_aggregation(:balance) # => the balance AggregateReflection
#
def reflect_on_aggregation(aggregation)
reflections[aggregation].is_a?(AggregateReflection) ? reflections[aggregation] : nil
diff --git a/activeresource/README.rdoc b/activeresource/README.rdoc
index 127ac5b4a9..ad58eaf5fd 100644
--- a/activeresource/README.rdoc
+++ b/activeresource/README.rdoc
@@ -34,7 +34,7 @@ lifecycle methods that operate against a persistent store.
# Find a person with id = 1
ryan = Person.find(1)
- Person.exists?(1) #=> true
+ Person.exists?(1) # => true
As you can see, the methods are quite similar to Active Record's methods for dealing with database
records. But rather than dealing directly with a database record, you're dealing with HTTP resources (which may or may not be database records).
@@ -69,8 +69,8 @@ for a request for a single element, the XML of that item is expected in response
The XML document that is received is used to build a new object of type Person, with each
XML element becoming an attribute on the object.
- ryan.is_a? Person #=> true
- ryan.attribute1 #=> 'value1'
+ ryan.is_a? Person # => true
+ ryan.attribute1 # => 'value1'
Any complex element (one that contains other elements) becomes its own object:
@@ -81,8 +81,8 @@ Any complex element (one that contains other elements) becomes its own object:
# for GET http://api.people.com:3000/people/1.xml
#
ryan = Person.find(1)
- ryan.complex #=> <Person::Complex::xxxxx>
- ryan.complex.attribute2 #=> 'value2'
+ ryan.complex # => <Person::Complex::xxxxx>
+ ryan.complex.attribute2 # => 'value2'
Collections can also be requested in a similar fashion
@@ -96,8 +96,8 @@ Collections can also be requested in a similar fashion
# for GET http://api.people.com:3000/people.xml
#
people = Person.find(:all)
- people.first #=> <Person::xxx 'first' => 'Ryan' ...>
- people.last #=> <Person::xxx 'first' => 'Jim' ...>
+ people.first # => <Person::xxx 'first' => 'Ryan' ...>
+ people.last # => <Person::xxx 'first' => 'Jim' ...>
==== Create
@@ -118,10 +118,10 @@ as the id of the ARes object.
# Response (201): Location: http://api.people.com:3000/people/2
#
ryan = Person.new(:first => 'Ryan')
- ryan.new? #=> true
- ryan.save #=> true
- ryan.new? #=> false
- ryan.id #=> 2
+ ryan.new? # => true
+ ryan.save # => true
+ ryan.new? # => false
+ ryan.id # => 2
==== Update
@@ -139,9 +139,9 @@ server side was successful.
# is expected with code (204)
#
ryan = Person.find(1)
- ryan.first #=> 'Ryan'
+ ryan.first # => 'Ryan'
ryan.first = 'Rizzle'
- ryan.save #=> true
+ ryan.save # => true
==== Delete
@@ -155,10 +155,10 @@ Destruction of a resource can be invoked as a class and instance method of the r
# is expected with response code (200)
#
ryan = Person.find(1)
- ryan.destroy #=> true
- ryan.exists? #=> false
- Person.delete(2) #=> true
- Person.exists?(2) #=> false
+ ryan.destroy # => true
+ ryan.exists? # => false
+ Person.delete(2) # => true
+ Person.exists?(2) # => false
You can find more usage information in the ActiveResource::Base documentation.
diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG
index 8485e7d46b..53e4d19804 100644
--- a/activesupport/CHANGELOG
+++ b/activesupport/CHANGELOG
@@ -245,8 +245,8 @@ ActiveSupport.escape_html_entities_in_json from true to false to match previousl
* Add Array#in_groups which splits or iterates over the array in specified number of groups. #579. [Adrian Mugnolo] Example:
a = (1..10).to_a
- a.in_groups(3) #=> [[1, 2, 3, 4], [5, 6, 7, nil], [8, 9, 10, nil]]
- a.in_groups(3, false) #=> [[1, 2, 3, 4], [5, 6, 7], [8, 9, 10]]
+ a.in_groups(3) # => [[1, 2, 3, 4], [5, 6, 7, nil], [8, 9, 10, nil]]
+ a.in_groups(3, false) # => [[1, 2, 3, 4], [5, 6, 7], [8, 9, 10]]
* Fix TimeWithZone unmarshaling: coerce unmarshaled Time instances to utc, because Ruby's marshaling of Time instances doesn't respect the zone [Geoff Buesing]
@@ -942,7 +942,7 @@ public for compatibility. [Jeremy Kemper]
* Enhance Symbol#to_proc so it works with list objects, such as multi-dimensional arrays. Closes #5295 [nov@yo.rim.or.jp]. Example:
{1 => "one", 2 => "two", 3 => "three"}.sort_by(&:first).map(&:last)
- #=> ["one", "two", "three"]
+ # => ["one", "two", "three"]
* Added Hash.create_from_xml(string) which will create a hash from a XML string and even typecast if possible [David Heinemeier Hansson]. Example:
diff --git a/activesupport/lib/active_support/core_ext/class/attribute.rb b/activesupport/lib/active_support/core_ext/class/attribute.rb
index bfa57fe1f7..79d5c40e5f 100644
--- a/activesupport/lib/active_support/core_ext/class/attribute.rb
+++ b/activesupport/lib/active_support/core_ext/class/attribute.rb
@@ -29,19 +29,19 @@ class Class
# In such cases, you don't want to do changes in places but use setters:
#
# Base.setting = []
- # Base.setting #=> []
- # Subclass.setting #=> []
+ # Base.setting # => []
+ # Subclass.setting # => []
#
# # Appending in child changes both parent and child because it is the same object:
# Subclass.setting << :foo
- # Base.setting #=> [:foo]
- # Subclass.setting #=> [:foo]
+ # Base.setting # => [:foo]
+ # Subclass.setting # => [:foo]
#
# # Use setters to not propagate changes:
# Base.setting = []
# Subclass.setting += [:foo]
- # Base.setting #=> []
- # Subclass.setting #=> [:foo]
+ # Base.setting # => []
+ # Subclass.setting # => [:foo]
#
# For convenience, a query method is defined as well:
#
diff --git a/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb b/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb
index 4e35b1b488..a903735acf 100644
--- a/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb
+++ b/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb
@@ -12,8 +12,8 @@ require 'active_support/core_ext/array/extract_options'
# end
#
# Person.hair_colors = [:brown, :black, :blonde, :red]
-# Person.hair_colors #=> [:brown, :black, :blonde, :red]
-# Person.new.hair_colors #=> [:brown, :black, :blonde, :red]
+# Person.hair_colors # => [:brown, :black, :blonde, :red]
+# Person.new.hair_colors # => [:brown, :black, :blonde, :red]
#
# To opt out of the instance writer method, pass :instance_writer => false.
# To opt out of the instance reader method, pass :instance_reader => false.
diff --git a/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb b/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb
index e844cf50d1..6891c66839 100644
--- a/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb
+++ b/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb
@@ -22,8 +22,8 @@ end
# end
#
# Person.hair_colors = [:brown, :black, :blonde, :red]
-# Person.hair_colors #=> [:brown, :black, :blonde, :red]
-# Person.new.hair_colors #=> [:brown, :black, :blonde, :red]
+# Person.hair_colors # => [:brown, :black, :blonde, :red]
+# Person.new.hair_colors # => [:brown, :black, :blonde, :red]
#
# To opt out of the instance writer method, pass :instance_writer => false.
# To opt out of the instance reader method, pass :instance_reader => false.
diff --git a/railties/guides/source/security.textile b/railties/guides/source/security.textile
index 8ce0001080..6372c606b7 100644
--- a/railties/guides/source/security.textile
+++ b/railties/guides/source/security.textile
@@ -371,7 +371,7 @@ The mass-assignment feature may become a problem, as it allows an attacker to se
<ruby>
def signup
- params[:user] #=> {:name => “ow3ned”, :admin => true}
+ params[:user] # => {:name => “ow3ned”, :admin => true}
@user = User.new(params[:user])
end
</ruby>
@@ -385,7 +385,7 @@ Mass-assignment saves you much work, because you don't have to set each value in
This will set the following parameters in the controller:
<ruby>
-params[:user] #=> {:name => “ow3ned”, :admin => true}
+params[:user] # => {:name => “ow3ned”, :admin => true}
</ruby>
So if you create a new user using mass-assignment, it may be too easy to become an administrator.
@@ -423,11 +423,11 @@ attr_accessible :name
If you want to set a protected attribute, you will to have to assign it individually:
<ruby>
-params[:user] #=> {:name => "ow3ned", :admin => true}
+params[:user] # => {:name => "ow3ned", :admin => true}
@user = User.new(params[:user])
-@user.admin #=> false # not mass-assigned
+@user.admin # => false # not mass-assigned
@user.admin = true
-@user.admin #=> true
+@user.admin # => true
</ruby>
A more paranoid technique to protect your whole project would be to enforce that all models whitelist their accessible attributes. This can be easily achieved with a very simple initializer: