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) ⇒ 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

#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

Returns the value of attribute wrapper.



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

def wrapper
  @wrapper
end