Class: Gorillib::Builder::GetsetCollectionField

Inherits:
Model::SimpleCollectionField show all
Defined in:
lib/gorillib/builder.rb

Instance Attribute Summary

Attributes inherited from Model::SimpleCollectionField

#item_type

Attributes inherited from Model::Field

#_extra_attributes, #doc, #model, #name, #type

Instance Method Summary collapse

Methods inherited from Model::SimpleCollectionField

#initialize

Methods inherited from Model::Field

#==, #initialize, #inspect, #inspect_compact, receive, #to_hash, #to_s, #visibility

Methods included from Model

#==, #as_json, #attribute_set?, #attribute_values, #attributes, #compact_attributes, #handle_extra_attributes, #initialize, #inspect, #inspect_compact, #read_attribute, #read_unset_attribute, #receive!, #to_inspectable, #to_json, #to_s, #to_tsv, #to_wire, #unset_attribute, #update_attributes, #write_attribute

Methods included from Concern

#append_features, extended, #included

Constructor Details

This class inherits a constructor from Gorillib::Model::SimpleCollectionField

Instance Method Details

#inscribe_methods(model) ⇒ Object



224
225
226
227
228
229
230
231
232
233
234
# File 'lib/gorillib/builder.rb', line 224

def inscribe_methods(model)
  raise "Plural and singular names must differ: #{self.plural_name}" if (singular_name == plural_name)
  #
  @visibilities[:writer] = false
  model.__send__(:define_attribute_reader,   self.name, self.type, visibility(:reader))
  model.__send__(:define_attribute_tester,   self.name, self.type, visibility(:tester))
  #
  model.__send__(:define_collection_receiver, self)
  model.__send__(:define_collection_getset,   self)
  model.__send__(:define_collection_tester,   self)
end

#singular_nameObject



220
221
222
# File 'lib/gorillib/builder.rb', line 220

def singular_name
  @singular_name ||= Gorillib::Inflector.singularize(name.to_s).to_sym
end