Class: TaoForm::Components::MomentPicker::SegmentListComponent
- Inherits:
-
TaoOnRails::Components::Base
- Object
- TaoOnRails::Components::Base
- TaoForm::Components::MomentPicker::SegmentListComponent
- Defined in:
- lib/tao_form/components/moment_picker/segment_list_component.rb
Instance Attribute Summary collapse
-
#segment_options ⇒ Object
readonly
Returns the value of attribute segment_options.
-
#segments ⇒ Object
readonly
Returns the value of attribute segments.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(view, options = {}) ⇒ SegmentListComponent
constructor
A new instance of SegmentListComponent.
- #render_segment(segment) ⇒ Object
- #separator_segment?(segment) ⇒ Boolean
Constructor Details
#initialize(view, options = {}) ⇒ SegmentListComponent
Returns a new instance of SegmentListComponent.
8 9 10 11 12 |
# File 'lib/tao_form/components/moment_picker/segment_list_component.rb', line 8 def initialize view, = {} super view, @segments = @options.delete(:segments) end |
Instance Attribute Details
#segment_options ⇒ Object (readonly)
Returns the value of attribute segment_options.
6 7 8 |
# File 'lib/tao_form/components/moment_picker/segment_list_component.rb', line 6 def @segment_options end |
#segments ⇒ Object (readonly)
Returns the value of attribute segments.
6 7 8 |
# File 'lib/tao_form/components/moment_picker/segment_list_component.rb', line 6 def segments @segments end |
Class Method Details
.component_name ⇒ Object
31 32 33 |
# File 'lib/tao_form/components/moment_picker/segment_list_component.rb', line 31 def self.component_name :moment_picker_segment_list end |
Instance Method Details
#render_segment(segment) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/tao_form/components/moment_picker/segment_list_component.rb', line 18 def render_segment segment if segment.is_a? Hash segment = segment.clone name = segment.delete(:name) opts = .merge segment else name = segment opts = end view.send :"tao_moment_picker_#{name}_segment", opts end |
#separator_segment?(segment) ⇒ Boolean
14 15 16 |
# File 'lib/tao_form/components/moment_picker/segment_list_component.rb', line 14 def separator_segment? segment segment.is_a?(Hash) && segment[:separator].present? end |