Module: Gorillib::FancyBuilder::ClassMethods
- Includes:
- Builder::ClassMethods
- Defined in:
- lib/gorillib/builder.rb
Instance Method Summary collapse
- #belongs_to(field_name, type, options = {}) ⇒ Object
- #collects(type, clxn_name) ⇒ Object
- #option(field_name, options = {}) ⇒ Object
Methods included from Builder::ClassMethods
Methods included from Model::ClassMethods
#assemble_positionals, #attrs_hash_from_args, #collection, #field, #field_names, #fields, #from_tuple, #has_field?, #inspect, #inspect_compact, #native?, #positionals, #receive, #typename
Instance Method Details
#belongs_to(field_name, type, options = {}) ⇒ Object
168 169 170 171 172 173 174 175 |
# File 'lib/gorillib/builder.rb', line 168 def belongs_to(field_name, type, ={}) field = member(field_name, type) "#{field.name}_name" do val = getset_member(field) or return nil val.name end field end |
#collects(type, clxn_name) ⇒ Object
182 183 184 185 186 187 |
# File 'lib/gorillib/builder.rb', line 182 def collects(type, clxn_name) type_handle = type.handle type_handle do |item_name, attrs={}, ={}, &block| send(clxn_name, item_name, attrs, .merge(:factory => type), &block) end end |