Class: GoonModelGen::Golang::Struct
- Inherits:
-
Type
- Object
- Type
- GoonModelGen::Golang::Struct
show all
- Defined in:
- lib/goon_model_gen/golang/struct.rb
Instance Attribute Summary collapse
Attributes inherited from Type
#name, #package
Instance Method Summary
collapse
Methods inherited from Type
#initialize, #memo, #qualified_name
Instance Attribute Details
#ref_name ⇒ Object
Returns the value of attribute ref_name.
9
10
11
|
# File 'lib/goon_model_gen/golang/struct.rb', line 9
def ref_name
@ref_name
end
|
Instance Method Details
#fields ⇒ Object
11
12
13
|
# File 'lib/goon_model_gen/golang/struct.rb', line 11
def fields
@fields ||= []
end
|
#id_field ⇒ Object
25
26
27
|
# File 'lib/goon_model_gen/golang/struct.rb', line 25
def id_field
fields.detect(&:goon_id)
end
|
#new_field(name, t, tags, options = {}) ⇒ Object
18
19
20
21
22
23
|
# File 'lib/goon_model_gen/golang/struct.rb', line 18
def new_field(name, t, tags, options = {})
Field.new(name, t, tags, options).tap do |f|
f.struct = self
fields.push(f)
end
end
|
#resolve(pkgs) ⇒ Object
30
31
32
33
34
|
# File 'lib/goon_model_gen/golang/struct.rb', line 30
def resolve(pkgs)
fields.each do |f|
f.resolve(pkgs)
end
end
|