Class: Keisan::AST::Time

Inherits:
ConstantLiteral show all
Includes:
DateTimeMethods
Defined in:
lib/keisan/ast/time.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DateTimeMethods

#+, #<, #<=, #>, #>=, #equal, #not_equal

Methods inherited from ConstantLiteral

#!, #%, #&, #*, #**, #+, #+@, #-, #-@, #/, #<, #<<, #<=, #==, #>, #>=, #>>, #^, #and, #equal, #evaluate, #is_constant?, #not_equal, #or, #|, #~

Methods inherited from Node

#!, #%, #&, #*, #**, #+, #+@, #-, #-@, #/, #<, #<<, #<=, #>, #>=, #>>, #^, #and, #coerce, #contains_a?, #deep_dup, #differentiate, #differentiated, #equal, #evaluate, #evaluate_assignments, #evaluated, #false?, #is_constant?, #not_equal, #or, #replace, #replaced, #simplified, #simplify, #to_cell, #to_node, #traverse, #true?, #unbound_functions, #unbound_variables, #well_defined?, #|, #~

Constructor Details

#initialize(time) ⇒ Time

Returns a new instance of Time.



10
11
12
# File 'lib/keisan/ast/time.rb', line 10

def initialize(time)
  @time = time
end

Instance Attribute Details

#timeObject (readonly)

Returns the value of attribute time.



8
9
10
# File 'lib/keisan/ast/time.rb', line 8

def time
  @time
end

Instance Method Details

#to_sObject



18
19
20
# File 'lib/keisan/ast/time.rb', line 18

def to_s
  value.strftime("%Y-%m-%d %H:%M:%S")
end

#value(context = nil) ⇒ Object



14
15
16
# File 'lib/keisan/ast/time.rb', line 14

def value(context = nil)
  time
end