Class: Temporal::Units::Base

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/temporal/units/base.rb

Direct Known Subclasses

Day, Month, Year

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Base

Returns a new instance of Base.



7
8
9
# File 'lib/temporal/units/base.rb', line 7

def initialize(value)
  self.value = value
end

Instance Method Details

#+(other) ⇒ Object



15
# File 'lib/temporal/units/base.rb', line 15

def +(other) = self.class.new(@value + other)

#-(other) ⇒ Object



17
# File 'lib/temporal/units/base.rb', line 17

def -(other) = self.class.new(@value - other)

#<=>(other) ⇒ Object



11
# File 'lib/temporal/units/base.rb', line 11

def <=>(other) = @value <=> other

#==(other) ⇒ Object



13
# File 'lib/temporal/units/base.rb', line 13

def ==(other) = @value == other

#inspectObject



25
26
27
# File 'lib/temporal/units/base.rb', line 25

def inspect
  "<#{self.class} @value=#{@value} @reference=#{@reference}>"
end

#to_fObject



23
# File 'lib/temporal/units/base.rb', line 23

def to_f = @value.to_f

#to_iObject



21
# File 'lib/temporal/units/base.rb', line 21

def to_i = @value.to_i

#to_sObject



19
# File 'lib/temporal/units/base.rb', line 19

def to_s = @value.to_s