Class: ROXML::HashDefinition
Overview
:nodoc:
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
-
#wrapper ⇒ Object
Returns the value of attribute wrapper.
Instance Method Summary collapse
-
#initialize(opts) ⇒ HashDefinition
constructor
A new instance of HashDefinition.
Constructor Details
#initialize(opts) ⇒ HashDefinition
Returns a new instance of HashDefinition.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/roxml/hash_definition.rb', line 9 def initialize(opts) unless (invalid_keys = opts.keys - HASH_KEYS).empty? raise ArgumentError, "Invalid Hash description keys: #{invalid_keys.join(', ')}" end if opts.has_key? :attrs ActiveSupport::Deprecation.warn(":as => {:attrs} is going away in 3.0. Use explicit :key and :value instead.") @key = to_hash_args(opts, :from => "@#{opts[:attrs][0]}") @value = to_hash_args(opts, :from => "@#{opts[:attrs][1]}") else @key = to_hash_args opts, fetch_element(opts, :key) @value = to_hash_args opts, fetch_element(opts, :value) end end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
6 7 8 |
# File 'lib/roxml/hash_definition.rb', line 6 def key @key end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
6 7 8 |
# File 'lib/roxml/hash_definition.rb', line 6 def value @value end |
#wrapper ⇒ Object
Returns the value of attribute wrapper.
7 8 9 |
# File 'lib/roxml/hash_definition.rb', line 7 def wrapper @wrapper end |