Class: Infobar::Duration

Inherits:
Object show all
Defined in:
lib/infobar/duration.rb

Instance Method Summary collapse

Constructor Details

#initialize(value, format: nil) ⇒ Duration

Returns a new instance of Duration.



2
3
4
5
6
7
8
9
10
# File 'lib/infobar/duration.rb', line 2

def initialize(value, format: nil)
  duration = Tins::Duration.new(value)
  @string =
    if format
      duration.format(format)
    else
      duration
    end.to_s
end

Instance Method Details

#to_sObject



12
13
14
# File 'lib/infobar/duration.rb', line 12

def to_s
  @string
end