Sha256: 6b73d77ef74660f0e57df69022c7af080cfde503787e9cdd3a6ddb76dc99ba27

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

class TokyoMetro::Factory::Generate::Static::MetaClass::Info::Normal < TokyoMetro::Factory::Generate::Static::MetaClass::Info::Fundamental

  def initialize( same_as , h )
    @same_as = same_as
    @h = h.with_indifferent_access
    @hash_for_making_variables = ::Hash.new.with_indifferent_access

    # puts "same_as: #{ same_as }"
    # puts "hash keys: #{ @h.keys }"

    set_values_to_hash_for_making_variables
  end

  def variables
    # puts "variables: " + ( [ @same_as ] + variables_from_hash_keys ).to_s
    # puts "length: " + ( [ @same_as ] + variables_from_hash_keys ).length.to_s
    # puts ""
    [ @same_as ] + super
  end

  def variables_from_hash_keys( hash_key_array: self.class.hash_keys , info: @hash_for_making_variables )
    if info.nil?
      super( hash_key_array: hash_key_array )
    elsif info.kind_of?( ::Hash )
      hash_key_array.map { | key_name | info[ key_name ] }
    else
      hash_key_array.map { | key_name | info.send( key_name ) }
    end
  end

  alias :variables_from_hash_keys__alias :variables_from_hash_keys

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tokyo_metro-0.10.1 lib/tokyo_metro/factory/generate/static/meta_class/info/normal.rb