Class: GoonModelGen::Golang::CombinationType

Inherits:
Type
  • Object
show all
Defined in:
lib/goon_model_gen/golang/combination_type.rb

Defined Under Namespace

Classes: ItemType

Instance Attribute Summary collapse

Attributes inherited from Type

#name, #package

Instance Method Summary collapse

Methods inherited from Type

#memo, #qualified_name

Constructor Details

#initialize(name) ⇒ CombinationType

Returns a new instance of CombinationType.

Parameters:

  • name (String)


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

#mapObject (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

#fieldsObject



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

Parameters:



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