Module: ZeroFormatter::ZeroFormattable::ClassMethods
- Defined in:
- lib/zero_formatter/zero_formattable.rb
Instance Method Summary collapse
Instance Method Details
#field(name, type, options = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/zero_formatter/zero_formattable.rb', line 12 def field(name, type, ={}) @fields ||= [] index = [:index] || @fields.size == 0 ? 0 : @fields.last[:index] + 1 @fields << { index: index, name: name, type: type, options: , } attr_accessor name return end |
#fields ⇒ Object
8 9 10 |
# File 'lib/zero_formatter/zero_formattable.rb', line 8 def fields @fields || [] end |