Skip to content

Commit

Permalink
[ci skip] Replace #=> with # =>
Browse files Browse the repository at this point in the history
  • Loading branch information
notalex committed Nov 12, 2013
1 parent 5735a77 commit b9a4560
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion guides/source/2_2_release_notes.md
Expand Up @@ -327,7 +327,7 @@ Other features of memoization include `unmemoize`, `unmemoize_all`, and `memoize
The `each_with_object` method provides an alternative to `inject`, using a method backported from Ruby 1.9. It iterates over a collection, passing the current element and the memo into the block.

```ruby
%w(foo bar).each_with_object({}) { |str, hsh| hsh[str] = str.upcase } #=> {'foo' => 'FOO', 'bar' => 'BAR'}
%w(foo bar).each_with_object({}) { |str, hsh| hsh[str] = str.upcase } # => {'foo' => 'FOO', 'bar' => 'BAR'}
```

Lead Contributor: [Adam Keys](http://therealadam.com/)
Expand Down
18 changes: 9 additions & 9 deletions guides/source/active_record_validations.md
Expand Up @@ -175,28 +175,28 @@ class Person < ActiveRecord::Base
end

>> p = Person.new
#=> #<Person id: nil, name: nil>
# => #<Person id: nil, name: nil>
>> p.errors.messages
#=> {}
# => {}

>> p.valid?
#=> false
# => false
>> p.errors.messages
#=> {name:["can't be blank"]}
# => {name:["can't be blank"]}

>> p = Person.create
#=> #<Person id: nil, name: nil>
# => #<Person id: nil, name: nil>
>> p.errors.messages
#=> {name:["can't be blank"]}
# => {name:["can't be blank"]}

>> p.save
#=> false
# => false

>> p.save!
#=> ActiveRecord::RecordInvalid: Validation failed: Name can't be blank
# => ActiveRecord::RecordInvalid: Validation failed: Name can't be blank

>> Person.create!
#=> ActiveRecord::RecordInvalid: Validation failed: Name can't be blank
# => ActiveRecord::RecordInvalid: Validation failed: Name can't be blank
```

`invalid?` is simply the inverse of `valid?`. It triggers your validations,
Expand Down
14 changes: 7 additions & 7 deletions guides/source/active_support_core_extensions.md
Expand Up @@ -176,14 +176,14 @@ duplicate = array.dup
duplicate.push 'another-string'

# the object was duplicated, so the element was added only to the duplicate
array #=> ['string']
duplicate #=> ['string', 'another-string']
array # => ['string']
duplicate # => ['string', 'another-string']

duplicate.first.gsub!('string', 'foo')

# first element was not duplicated, it will be changed in both arrays
array #=> ['foo']
duplicate #=> ['foo', 'another-string']
array # => ['foo']
duplicate # => ['foo', 'another-string']
```

As you can see, after duplicating the `Array` instance, we got another object, therefore we can modify it and the original object will stay unchanged. This is not true for array's elements, however. Since `dup` does not make deep copy, the string inside the array is still the same object.
Expand All @@ -196,8 +196,8 @@ duplicate = array.deep_dup

duplicate.first.gsub!('string', 'foo')

array #=> ['string']
duplicate #=> ['foo']
array # => ['string']
duplicate # => ['foo']
```

If the object is not duplicable, `deep_dup` will just return it:
Expand Down Expand Up @@ -1542,7 +1542,7 @@ ActiveSupport::Inflector.inflections do |inflect|
inflect.acronym 'SSL'
end

"SSLError".underscore.camelize #=> "SSLError"
"SSLError".underscore.camelize # => "SSLError"
```

`camelize` is aliased to `camelcase`.
Expand Down

0 comments on commit b9a4560

Please sign in to comment.