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
readonly
Returns the value of attribute wrapper.
Instance Method Summary collapse
-
#initialize(opts, wrapper) ⇒ HashDefinition
constructor
A new instance of HashDefinition.
Constructor Details
#initialize(opts, wrapper) ⇒ HashDefinition
Returns a new instance of HashDefinition.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/roxml/hash_definition.rb', line 8 def initialize(opts, wrapper) unless (invalid_keys = opts.keys - HASH_KEYS).empty? raise ArgumentError, "Invalid Hash description keys: #{invalid_keys.join(', ')}" end @wrapper = wrapper if opts.has_key? :attrs @key = to_hash_args(opts, :attr, opts[:attrs][0]) @value = to_hash_args(opts, :attr, 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 (readonly)
Returns the value of attribute wrapper.
6 7 8 |
# File 'lib/roxml/hash_definition.rb', line 6 def wrapper @wrapper end |