Class: Caisson::Helpers::Form::Builder::Field::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/caisson/helpers/form/builder/field/base.rb

Direct Known Subclasses

Checkbox, Money, Password, Percent, Select, Text, Textarea

Defined Under Namespace

Classes: OptionParser

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(core, record, name, options = {}) ⇒ Base

************************************************************************************* CONSTRUCTOR *************************************************************************************



11
12
13
14
15
16
17
# File 'lib/caisson/helpers/form/builder/field/base.rb', line 11

def initialize(core, record, name, options={})
  @core = core
  @record = record
  @name = name

  @options = OptionParser.new(@record, @name, options).parse
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args, &block) ⇒ Object (private)



69
70
71
72
73
74
75
# File 'lib/caisson/helpers/form/builder/field/base.rb', line 69

def method_missing(*args, &block)
  if [:check_box, :content_tag].include?(args.first)
    return @core.send(*args, &block)
  else
    raise NoMethodError.new("undefined local variable or method '#{args.first}' for #{self.class}")
  end
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/caisson/helpers/form/builder/field/base.rb', line 6

def name
  @name
end