Class: TokyoMetro::Factory::Generate::Static::MetaClass::Info::Normal
- Inherits:
-
Fundamental
- Object
- Fundamental
- TokyoMetro::Factory::Generate::Static::MetaClass::Info::Normal
- Defined in:
- lib/tokyo_metro/factory/generate/static/meta_class/info/normal.rb
Direct Known Subclasses
Operator::Info, RailwayDirection::Info, RailwayLine::Info, Station::InEachRailwayLine::Info, StationsInTokyoMetro::Info, TrainType::Custom::OtherOperator::Info, TrainType::InApi::Info
Instance Method Summary collapse
-
#initialize(same_as, h) ⇒ Normal
constructor
A new instance of Normal.
- #variables ⇒ Object
- #variables_from_hash_keys(hash_key_array: self.class.hash_keys, info: @hash_for_making_variables) ⇒ Object (also: #variables_from_hash_keys__alias)
Methods inherited from Fundamental
#generate, info_class_for_this_class, process
Constructor Details
#initialize(same_as, h) ⇒ Normal
Returns a new instance of Normal.
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/tokyo_metro/factory/generate/static/meta_class/info/normal.rb', line 3 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 |
Instance Method Details
#variables ⇒ Object
14 15 16 17 18 19 |
# File 'lib/tokyo_metro/factory/generate/static/meta_class/info/normal.rb', line 14 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 |
#variables_from_hash_keys(hash_key_array: self.class.hash_keys, info: @hash_for_making_variables) ⇒ Object Also known as: variables_from_hash_keys__alias
21 22 23 24 25 26 27 28 29 |
# File 'lib/tokyo_metro/factory/generate/static/meta_class/info/normal.rb', line 21 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 |