Module: Fieldable
- Included in:
- Array, FieldedArray
- Defined in:
- lib/arrayfields.rb
Overview
fields set and subsequently be auto-extended by ArrayFields
Instance Method Summary collapse
-
#fields(*values) ⇒ Object
access to field list.
-
#fields=(fields) ⇒ Object
sets fields and dynamically extends this Array instance with methods for keyword access.
-
#fieldset ⇒ Object
access to fieldset.
Instance Method Details
#fields(*values) ⇒ Object
access to field list
332 333 334 335 |
# File 'lib/arrayfields.rb', line 332 def fields *values return(send('fields=', *values)) unless values.empty? fieldset and fieldset.fields end |
#fields=(fields) ⇒ Object
sets fields and dynamically extends this Array instance with methods for keyword access
313 314 315 316 317 318 319 320 321 322 |
# File 'lib/arrayfields.rb', line 313 def fields= fields extend ArrayFields unless ArrayFields === self @fieldset = if ArrayFields::FieldSet === fields fields else ArrayFields::FieldSet.new fields end end |
#fieldset ⇒ Object
access to fieldset
326 327 328 |
# File 'lib/arrayfields.rb', line 326 def fieldset @fieldset ||= nil end |