Class: TaoForm::Components::MomentPicker::ResultComponent

Inherits:
FieldComponent
  • Object
show all
Defined in:
lib/tao_form/components/moment_picker/result_component.rb

Instance Attribute Summary collapse

Attributes inherited from FieldComponent

#attribute_name, #builder

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(view, builder = nil, attribute_name = nil, options = {}) ⇒ ResultComponent

Returns a new instance of ResultComponent.



8
9
10
11
12
13
14
# File 'lib/tao_form/components/moment_picker/result_component.rb', line 8

def initialize view, builder = nil, attribute_name = nil, options = {}
  super view, builder, attribute_name, options
  @input_type = options.delete(:input_type)
  @value = options.delete(:value)
  @icon = options.delete(:icon)
  @placeholder = options.delete(:placeholder)
end

Instance Attribute Details

#iconObject (readonly)

Returns the value of attribute icon.



6
7
8
# File 'lib/tao_form/components/moment_picker/result_component.rb', line 6

def icon
  @icon
end

#input_typeObject (readonly)

Returns the value of attribute input_type.



6
7
8
# File 'lib/tao_form/components/moment_picker/result_component.rb', line 6

def input_type
  @input_type
end

#placeholderObject (readonly)

Returns the value of attribute placeholder.



6
7
8
# File 'lib/tao_form/components/moment_picker/result_component.rb', line 6

def placeholder
  @placeholder
end

#valueObject (readonly)

Returns the value of attribute value.



6
7
8
# File 'lib/tao_form/components/moment_picker/result_component.rb', line 6

def value
  @value
end

Class Method Details

.component_nameObject



26
27
28
# File 'lib/tao_form/components/moment_picker/result_component.rb', line 26

def self.component_name
  :moment_picker_result
end

Instance Method Details

#render(&block) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/tao_form/components/moment_picker/result_component.rb', line 16

def render &block
  if block_given?
    super
  elsif builder && attribute_name
    super {
      builder.send :"#{input_type}_field", attribute_name, field_options
    }
  end
end