Class: Formic::Button

Inherits:
Base
  • Object
show all
Defined in:
lib/formic/button.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#content, #options, #page, #template

Instance Method Summary collapse

Methods inherited from Base

#add_class, default_template, #formics, #has_class?, #initialize, #merge_options, template, #to_s

Constructor Details

This class inherits a constructor from Formic::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, label = nil, options = {}, &block) ⇒ Object



16
17
18
19
20
# File 'lib/formic/button.rb', line 16

def method_missing method, label=nil, options={}, &block
  super method, label, options{}, &block
  @label ||=  method.to_s.underscore.titleize
  return self
end

Instance Attribute Details

#labelObject (readonly)

Returns the value of attribute label.



5
6
7
# File 'lib/formic/button.rb', line 5

def label
  @label
end

Instance Method Details

#_initialize(label = nil, options = {}, &block) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/formic/button.rb', line 6

def _initialize label=nil, options={}, &block
  if label.instance_of? Hash
    options = label
    label = nil
  end

  super options, &block
  @label = label
end