Class: IntervalNotation::Segmentation::Segment
- Inherits:
-
Struct
- Object
- Struct
- IntervalNotation::Segmentation::Segment
- Defined in:
- lib/interval_notation/segmentation.rb
Overview
Helper class to store a state of a segment
Instance Attribute Summary collapse
-
#interval ⇒ Object
Returns the value of attribute interval.
-
#state ⇒ Object
Returns the value of attribute state.
Instance Method Summary collapse
Instance Attribute Details
#interval ⇒ Object
Returns the value of attribute interval
18 19 20 |
# File 'lib/interval_notation/segmentation.rb', line 18 def interval @interval end |
#state ⇒ Object
Returns the value of attribute state
18 19 20 |
# File 'lib/interval_notation/segmentation.rb', line 18 def state @state end |
Instance Method Details
#inspect ⇒ Object
27 |
# File 'lib/interval_notation/segmentation.rb', line 27 def inspect; to_s; end |
#to_s ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/interval_notation/segmentation.rb', line 19 def to_s if state.is_a?(Set) # Set#to_s don't show any content. Quite uninformative set_elements = '{' + state.to_a.join(', ') + '}' "<#{interval}: #{set_elements}>" else "<#{interval}: #{state}>" end end |