Class: TimespanRange
- Defined in:
- lib/timespan/core_ext/range.rb
Instance Attribute Summary collapse
-
#range ⇒ Object
Returns the value of attribute range.
-
#unit ⇒ Object
Returns the value of attribute unit.
Instance Method Summary collapse
-
#initialize(range, unit = :minutes) ⇒ TimespanRange
constructor
A new instance of TimespanRange.
- #to_s ⇒ Object
- #to_str ⇒ Object
Constructor Details
#initialize(range, unit = :minutes) ⇒ TimespanRange
Returns a new instance of TimespanRange.
4 5 6 7 8 9 |
# File 'lib/timespan/core_ext/range.rb', line 4 def initialize range, unit = :minutes range = (0..60) if range.min == nil || range.max == nil super(range, except: %w{to_s to_str}) @range = Timespan.new between: range @unit = unit.to_s.pluralize.to_sym end |