Class: Chronic::RepeaterTime::Tick

Inherits:
Object
  • Object
show all
Defined in:
lib/chronic/repeaters/repeater_time.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(time, ambiguous = false) ⇒ Tick

Returns a new instance of Tick.


5
6
7
8
# File 'lib/chronic/repeaters/repeater_time.rb', line 5

def initialize(time, ambiguous = false)
  @time = time
  @ambiguous = ambiguous
end

Instance Attribute Details

#timeObject

Returns the value of attribute time


3
4
5
# File 'lib/chronic/repeaters/repeater_time.rb', line 3

def time
  @time
end

Instance Method Details

#*(other) ⇒ Object


14
15
16
# File 'lib/chronic/repeaters/repeater_time.rb', line 14

def *(other)
  Tick.new(@time * other, @ambiguous)
end

#ambiguous?Boolean

Returns:

  • (Boolean)

10
11
12
# File 'lib/chronic/repeaters/repeater_time.rb', line 10

def ambiguous?
  @ambiguous
end

#to_fObject


18
19
20
# File 'lib/chronic/repeaters/repeater_time.rb', line 18

def to_f
  @time.to_f
end

#to_sObject


22
23
24
# File 'lib/chronic/repeaters/repeater_time.rb', line 22

def to_s
  @time.to_s + (@ambiguous ? '?' : '')
end