Class: ROXML::HashDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/roxml/hash_definition.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#keyObject (readonly)

Returns the value of attribute key.



6
7
8
# File 'lib/roxml/hash_definition.rb', line 6

def key
  @key
end

#valueObject (readonly)

Returns the value of attribute value.



6
7
8
# File 'lib/roxml/hash_definition.rb', line 6

def value
  @value
end

#wrapperObject (readonly)

Returns the value of attribute wrapper.



6
7
8
# File 'lib/roxml/hash_definition.rb', line 6

def wrapper
  @wrapper
end