Class: GoonModelGen::Golang::CombinationType
- Defined in:
- lib/goon_model_gen/golang/combination_type.rb
Defined Under Namespace
Classes: ItemType
Instance Attribute Summary collapse
-
#map ⇒ Object
readonly
Returns the value of attribute map.
Attributes inherited from Type
Instance Method Summary collapse
- #add(key, name, package_path, package_base_path = nil) ⇒ Object
- #fields ⇒ Object
-
#initialize(name) ⇒ CombinationType
constructor
A new instance of CombinationType.
- #resolve(pkgs) ⇒ Object
Methods inherited from Type
Constructor Details
#initialize(name) ⇒ CombinationType
Returns a new instance of CombinationType.
28 29 30 31 |
# File 'lib/goon_model_gen/golang/combination_type.rb', line 28 def initialize(name) super(name) @map = {} end |
Instance Attribute Details
#map ⇒ Object (readonly)
Returns the value of attribute map.
25 26 27 |
# File 'lib/goon_model_gen/golang/combination_type.rb', line 25 def map @map end |
Instance Method Details
#add(key, name, package_path, package_base_path = nil) ⇒ Object
33 34 35 |
# File 'lib/goon_model_gen/golang/combination_type.rb', line 33 def add(key, name, package_path, package_base_path = nil) map[key] = ItemType.new(name, package_path, package_base_path) end |
#fields ⇒ Object
44 45 46 |
# File 'lib/goon_model_gen/golang/combination_type.rb', line 44 def fields map.values.map{|i| i.respond_to?(:fields) ? i.fields : []}.flatten end |
#resolve(pkgs) ⇒ Object
38 39 40 41 42 |
# File 'lib/goon_model_gen/golang/combination_type.rb', line 38 def resolve(pkgs) map.each do |_, item| item.resolve(pkgs) end end |