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.


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

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

Instance Attribute Details

#timeObject

Returns the value of attribute time


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

def time
  @time
end

Instance Method Details

#*(other) ⇒ Object


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

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

#ambiguous?Boolean

Returns:

  • (Boolean)

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

def ambiguous?
  @ambiguous
end

#to_fObject


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

def to_f
  @time.to_f
end

#to_sObject


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

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