Sha256: 008c5af966f786b04f29c2f389c8c03b220747b5104c181f2636d2243a787ab3

Contents?: true

Size: 609 Bytes

Versions: 21

Compression:

Stored size: 609 Bytes

Contents

module ROXML
  class HashDefinition # :nodoc:
    attr_reader :key, :value
    attr_accessor :wrapper

    def initialize(opts)
      opts.assert_valid_keys(:key, :value)

      @key = Definition.new(nil, to_definition_options(opts, :key))
      @value = Definition.new(nil, to_definition_options(opts, :value))
    end

  private
    def to_definition_options(opts, what)
      case opts[what]
      when Hash
        opts[what]
      when String, Symbol
        {:from => opts[what]}
      else
        raise ArgumentError, "unrecognized hash parameter: #{what} => #{opts[what]}"
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 5 rubygems

Version Path
roxml-4.2.0 lib/roxml/hash_definition.rb
roxml-4.1.1 lib/roxml/hash_definition.rb
roxml-4.1.0 lib/roxml/hash_definition.rb
roxml-4.0.0 lib/roxml/hash_definition.rb
Empact-roxml-2.5.2 lib/roxml/hash_definition.rb
Empact-roxml-2.5.3 lib/roxml/hash_definition.rb
doxo-roxml-2.5.3 lib/roxml/hash_definition.rb
roxml-3.3.1 lib/roxml/hash_definition.rb
roxml-3.3.0 lib/roxml/hash_definition.rb
roxml-3.2.2 lib/roxml/hash_definition.rb
roxml-3.2.1 lib/roxml/hash_definition.rb
roxml-3.2.0 lib/roxml/hash_definition.rb
roxml-3.1.6 lib/roxml/hash_definition.rb
yob-roxml-3.1.6 lib/roxml/hash_definition.rb
roxml-3.1.5 lib/roxml/hash_definition.rb
roxml-3.1.4 lib/roxml/hash_definition.rb
roxml-3.1.3 lib/roxml/hash_definition.rb
roxml-3.1.2 lib/roxml/hash_definition.rb
roxml-3.1.1 lib/roxml/hash_definition.rb
roxml-3.1.0 lib/roxml/hash_definition.rb