class Yamload::Conversion::Hash

Public Class Methods

new(hash) click to toggle source
# File lib/yamload/conversion/hash.rb, line 7
def initialize(hash)
  fail ArgumentError, "#{array} is not a Hash" unless hash.is_a?(::Hash)
  @hash = hash.rekey
end

Public Instance Methods

to_immutable() click to toggle source
# File lib/yamload/conversion/hash.rb, line 12
def to_immutable
  immutable_objects_factory.new(converted_hash)
end

Private Instance Methods

converted_hash() click to toggle source
# File lib/yamload/conversion/hash.rb, line 26
def converted_hash
  @hash.map.with_object({}) { |(key, value), hash|
    hash[key] = Object.new(value).to_immutable
  }
end
immutable_objects_factory() click to toggle source
# File lib/yamload/conversion/hash.rb, line 18
def immutable_objects_factory
  anima = Anima.new(*@hash.keys)
  Class.new do
    include Adamantium
    include anima
  end
end