Class: Keisan::AST::Time
- Inherits:
-
ConstantLiteral
- Object
- Node
- Literal
- ConstantLiteral
- Keisan::AST::Time
- Includes:
- DateTimeMethods
- Defined in:
- lib/keisan/ast/time.rb
Instance Attribute Summary collapse
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Instance Method Summary collapse
-
#initialize(time) ⇒ Time
constructor
A new instance of Time.
- #to_s ⇒ Object
- #value(context = nil) ⇒ Object
Methods included from DateTimeMethods
#+, #<, #<=, #>, #>=, #equal, #not_equal
Methods inherited from ConstantLiteral
Methods inherited from Node
#!, #%, #&, #*, #**, #+, #+@, #-, #-@, #/, #<, #<<, #<=, #>, #>=, #>>, #^, #and, #coerce, #contains_a?, #deep_dup, #differentiate, #differentiated, #equal, #evaluate, #evaluate_assignments, #evaluated, #false?, #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
#time ⇒ Object (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_s ⇒ Object
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 |