Class: ActiveSupport::InheritableOptions
- Inherits:
-
OrderedOptions
- Object
- Hash
- OrderedOptions
- ActiveSupport::InheritableOptions
- Defined in:
- lib/active_support/ordered_options.rb
Direct Known Subclasses
Instance Method Summary collapse
- #inheritable_copy ⇒ Object
-
#initialize(parent = nil) ⇒ InheritableOptions
constructor
A new instance of InheritableOptions.
Methods inherited from OrderedOptions
#[], #[]=, #method_missing, #respond_to_missing?
Methods inherited from Hash
#as_json, #assert_valid_keys, #deep_dup, #deep_merge, #deep_merge!, #deep_stringify_keys, #deep_stringify_keys!, #deep_symbolize_keys, #deep_symbolize_keys!, #deep_transform_keys, #deep_transform_keys!, #diff, #encode_json, #except, #except!, #extract!, #extractable_options?, from_trusted_xml, from_xml, #reverse_merge, #reverse_merge!, #slice, #slice!, #stringify_keys, #stringify_keys!, #symbolize_keys, #symbolize_keys!, #to_param, #to_xml, #transform_keys, #transform_keys!, #with_indifferent_access
Constructor Details
#initialize(parent = nil) ⇒ InheritableOptions
Returns a new instance of InheritableOptions.
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/active_support/ordered_options.rb', line 44 def initialize(parent = nil) if parent.kind_of?(OrderedOptions) # use the faster _get when dealing with OrderedOptions super() { |h,k| parent._get(k) } elsif parent super() { |h,k| parent[k] } else super() end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ActiveSupport::OrderedOptions
Instance Method Details
#inheritable_copy ⇒ Object
55 56 57 |
# File 'lib/active_support/ordered_options.rb', line 55 def inheritable_copy self.class.new(self) end |