Class: GoonModelGen::Golang::CombinationType::ItemType

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, package_path, package_base_path = nil) ⇒ ItemType

Returns a new instance of ItemType.



11
12
13
# File 'lib/goon_model_gen/golang/combination_type.rb', line 11

def initialize(name, package_path, package_base_path = nil)
  @name, @package_path, @package_base_path = name, package_path, package_base_path
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



9
10
11
# File 'lib/goon_model_gen/golang/combination_type.rb', line 9

def name
  @name
end

#package_base_pathObject (readonly)

Returns the value of attribute package_base_path.



9
10
11
# File 'lib/goon_model_gen/golang/combination_type.rb', line 9

def package_base_path
  @package_base_path
end

#package_pathObject (readonly)

Returns the value of attribute package_path.



9
10
11
# File 'lib/goon_model_gen/golang/combination_type.rb', line 9

def package_path
  @package_path
end

#typeObject (readonly)

Returns the value of attribute type.



10
11
12
# File 'lib/goon_model_gen/golang/combination_type.rb', line 10

def type
  @type
end

Instance Method Details

#resolve(pkgs) ⇒ Object

Parameters:



20
21
22
# File 'lib/goon_model_gen/golang/combination_type.rb', line 20

def resolve(pkgs)
  @type = pkgs.type_by(**to_hash) || raise("Type not found by #{to_hash.inspect}")
end

#to_hashObject



15
16
17
# File 'lib/goon_model_gen/golang/combination_type.rb', line 15

def to_hash
  {name: name, package_path: package_path, package_base_path: package_base_path}
end