class TimespanRange
Attributes
range[RW]
unit[RW]
Public Class Methods
new(range, unit = :minutes)
click to toggle source
Calls superclass method
# 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
Public Instance Methods
to_s()
click to toggle source
# File lib/timespan/core_ext/range.rb, line 15 def to_s range.min.nil? ? 'no timespan range' : "#{range.min} to #{range.max} #{unit}" end
to_str()
click to toggle source
# File lib/timespan/core_ext/range.rb, line 11 def to_str to_s end