Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Hash Syntax changes to 1.9 format

  • Loading branch information...
commit 71c67d1fd863bfa8fa820e4dc6e1d158586d6d4b 1 parent d4db095
@AvnerCohen AvnerCohen authored
View
2  activesupport/lib/active_support/core_ext/array/wrap.rb
@@ -23,7 +23,7 @@ class Array
# The last point is particularly worth comparing for some enumerables:
#
# Array(foo: :bar) # => [[:foo, :bar]]
- # Array.wrap(foo: :bar) # => [{:foo => :bar}]
+ # Array.wrap(foo: :bar) # => [{foo: :bar}]
#
# There's also a related idiom that uses the splat operator:
#
View
2  activesupport/lib/active_support/core_ext/hash/conversions.rb
@@ -131,7 +131,7 @@ def typecast_xml_value(value)
else
xml_value = Hash[value.map { |k,v| [k, typecast_xml_value(v)] }]
- # Turn { :files => { :file => #<StringIO> } } into { :files => #<StringIO> } so it is compatible with
+ # Turn { files: { file: #<StringIO> } } into { files: #<StringIO> } so it is compatible with
# how multipart uploaded files from HTML appear
xml_value['file'].is_a?(StringIO) ? xml_value['file'] : xml_value
end
View
4 activesupport/lib/active_support/core_ext/hash/slice.rb
@@ -21,7 +21,7 @@ def slice(*keys)
# Returns a hash containing the removed key/value pairs.
#
# { a: 1, b: 2, c: 3, d: 4 }.slice!(:a, :b)
- # # => {:c => 3, :d => 4}
+ # # => {c: 3, d: 4}
def slice!(*keys)
keys.map! { |key| convert_key(key) } if respond_to?(:convert_key, true)
omit = slice(*self.keys - keys)
@@ -33,7 +33,7 @@ def slice!(*keys)
# Removes and returns the key/value pairs matching the given keys.
#
# { a: 1, b: 2, c: 3, d: 4 }.extract!(:a, :b)
- # # => {:a => 1, :b => 2}
+ # # => {a: 1, b: 2}
def extract!(*keys)
keys.each_with_object({}) { |key, result| result[key] = delete(key) }
end
View
8 activesupport/lib/active_support/core_ext/module/deprecation.rb
@@ -2,13 +2,13 @@
class Module
# deprecate :foo
- # deprecate :bar => 'message'
- # deprecate :foo, :bar, :baz => 'warning!', :qux => 'gone!'
+ # deprecate bar: 'message'
+ # deprecate :foo, :bar, baz: 'warning!', qux: 'gone!'
#
# You can also use custom deprecator instance:
#
- # deprecate :foo, :deprecator => MyLib::Deprecator.new
- # deprecate :foo, :bar => "warning!", :deprecator => MyLib::Deprecator.new
+ # deprecate :foo, deprecator: MyLib::Deprecator.new
+ # deprecate :foo, bar: "warning!", deprecator: MyLib::Deprecator.new
#
# \Custom deprecators must respond to <tt>deprecation_warning(deprecated_method_name, message, caller_backtrace)</tt>
# method where you can implement your custom warning behavior.
View
2  activesupport/lib/active_support/core_ext/time/calculations.rb
@@ -135,7 +135,7 @@ def since(seconds)
# Returns a new Time representing the start of the day (0:00)
def beginning_of_day
- #(self - seconds_since_midnight).change(:usec => 0)
+ #(self - seconds_since_midnight).change(usec: 0)
change(:hour => 0)
end
alias :midnight :beginning_of_day
Please sign in to comment.
Something went wrong with that request. Please try again.