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
-
#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 |
# File 'lib/tao_form/components/moment_picker/segment_list_component.rb', line 8 def initialize view, = {} @segments = .delete(:segments) super view, end |
Instance Attribute Details
#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
29 30 31 |
# File 'lib/tao_form/components/moment_picker/segment_list_component.rb', line 29 def self.component_name :moment_picker_segment_list end |
Instance Method Details
#render_segment(segment) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/tao_form/components/moment_picker/segment_list_component.rb', line 17 def render_segment segment if segment.is_a? Hash = segment name = segment.delete(:name) else = {} name = segment end view.send :"tao_moment_picker_#{name}_segment", end |
#separator_segment?(segment) ⇒ Boolean
13 14 15 |
# File 'lib/tao_form/components/moment_picker/segment_list_component.rb', line 13 def separator_segment? segment segment.is_a?(Hash) && segment[:separator].present? end |