From d8e84738ea810c7fac645349945ee765a5fc3cc4 Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Wed, 16 May 2012 00:24:38 -0500 Subject: removing 1.8 reference --- .../lib/active_support/core_ext/object/instance_variables.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/core_ext/object/instance_variables.rb b/activesupport/lib/active_support/core_ext/object/instance_variables.rb index 91fdf93eb2..3f310143aa 100644 --- a/activesupport/lib/active_support/core_ext/object/instance_variables.rb +++ b/activesupport/lib/active_support/core_ext/object/instance_variables.rb @@ -1,6 +1,6 @@ class Object # Returns a hash that maps instance variable names without "@" to their - # corresponding values. Keys are strings both in Ruby 1.8 and 1.9. + # corresponding values. Keys are strings. # # class C # def initialize(x, y) @@ -13,8 +13,7 @@ class Object Hash[instance_variables.map { |name| [name[1..-1], instance_variable_get(name)] }] end - # Returns an array of instance variable names including "@". They are strings - # both in Ruby 1.8 and 1.9. + # Returns an array of instance variable names including "@". They are strings. # # class C # def initialize(x, y) -- cgit v1.2.3 From b1dfcc968baa58d9a182ec7e129c901de0445971 Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Wed, 16 May 2012 14:44:57 -0500 Subject: update AS:OrderedHash docs --- activesupport/lib/active_support/ordered_hash.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/ordered_hash.rb b/activesupport/lib/active_support/ordered_hash.rb index 8edd3960c7..1a3693f766 100644 --- a/activesupport/lib/active_support/ordered_hash.rb +++ b/activesupport/lib/active_support/ordered_hash.rb @@ -5,16 +5,20 @@ YAML.add_builtin_type("omap") do |type, val| end module ActiveSupport - # The order of iteration over hashes in Ruby 1.8 is undefined. For example, you do not know the - # order in which +keys+ will return keys, or +each+ yield pairs. ActiveSupport::OrderedHash - # implements a hash that preserves insertion order, as in Ruby 1.9: + # ActiveSupport::OrderedHash implements a hash that preserves + # insertion order. # # oh = ActiveSupport::OrderedHash.new # oh[:a] = 1 # oh[:b] = 2 # oh.keys # => [:a, :b], this order is guaranteed # - # ActiveSupport::OrderedHash is namespaced to prevent conflicts with other implementations. + # Also, maps the +omap+ feature for YAML files + # (See http://yaml.org/type/omap.html) to support ordered items + # when loading from yaml. + # + # ActiveSupport::OrderedHash is namespaced to prevent conflicts + # with other implementations. class OrderedHash < ::Hash def to_yaml_type "!tag:yaml.org,2002:omap" -- cgit v1.2.3 From a3dd7a4f735374928e28709b2a09dcabe0d9df0c Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Thu, 17 May 2012 17:19:57 +0530 Subject: copy edit and remove nodoc on instance_values method [ci skip] --- .../lib/active_support/core_ext/object/instance_variables.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/core_ext/object/instance_variables.rb b/activesupport/lib/active_support/core_ext/object/instance_variables.rb index 3f310143aa..40821fd619 100644 --- a/activesupport/lib/active_support/core_ext/object/instance_variables.rb +++ b/activesupport/lib/active_support/core_ext/object/instance_variables.rb @@ -1,6 +1,6 @@ class Object - # Returns a hash that maps instance variable names without "@" to their - # corresponding values. Keys are strings. + # Returns a hash with string keys that maps instance variable names without "@" to their + # corresponding values. # # class C # def initialize(x, y) @@ -9,11 +9,11 @@ class Object # end # # C.new(0, 1).instance_values # => {"x" => 0, "y" => 1} - def instance_values #:nodoc: + def instance_values Hash[instance_variables.map { |name| [name[1..-1], instance_variable_get(name)] }] end - # Returns an array of instance variable names including "@". They are strings. + # Returns an array of instance variable names including "@". # # class C # def initialize(x, y) -- cgit v1.2.3