Class: GoonModelGen::Source::Struct

Inherits:
Type
  • Object
show all
Defined in:
lib/goon_model_gen/source/struct.rb

Instance Attribute Summary collapse

Attributes inherited from Type

#file, #generators, #name

Attributes included from Contextual

#context

Instance Method Summary collapse

Methods inherited from Type

#initialize

Constructor Details

This class inherits a constructor from GoonModelGen::Source::Type

Instance Attribute Details

#id_nameObject

Returns the value of attribute id_name.



9
10
11
# File 'lib/goon_model_gen/source/struct.rb', line 9

def id_name
  @id_name
end

#id_typeObject

Returns the value of attribute id_type.



9
10
11
# File 'lib/goon_model_gen/source/struct.rb', line 9

def id_type
  @id_type
end

#ref_nameObject

Returns the value of attribute ref_name.



10
11
12
# File 'lib/goon_model_gen/source/struct.rb', line 10

def ref_name
  @ref_name
end

Instance Method Details

#fieldsObject



12
13
14
# File 'lib/goon_model_gen/source/struct.rb', line 12

def fields
  @fields ||= []
end

#new_field(name, attrs) ⇒ Object

Parameters:

  • name (string)
  • attrs (Hash<String,Object>)


18
19
20
21
22
23
# File 'lib/goon_model_gen/source/struct.rb', line 18

def new_field(name, attrs)
  Field.new(name, attrs).tap do |f|
    f.context = self.context
    self.fields.push(f)
  end
end