Module: FixedFields::FieldMethods

Defined in:
lib/fixed_fields.rb

Instance Method Summary collapse

Instance Method Details

#fixed_field(attribute, options = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/fixed_fields.rb', line 7

def fixed_field(attribute, options={})
  unless included_modules.include? InstanceMethods
    extend ClassMethods
    include InstanceMethods
    
    class_eval { cattr_accessor :field_info }
    self.field_info = {}
  end
  
  options[:width] = options[:end] - options[:begin] if options[:width].blank?
  self.field_info[attribute] = options      
end