Class: CloudSesame::Query::AST::DateValue
- Inherits:
-
StringValue
- Object
- Abstract::Value
- StringValue
- CloudSesame::Query::AST::DateValue
- Defined in:
- lib/cloud_sesame/query/ast/date_value.rb
Constant Summary collapse
- COMPILE_FORMAT =
'%FT%TZ'.freeze
- DATETIME_FORMAT =
'%FT%T'.freeze
- TIME_FORMAT =
'%F %T %z'.freeze
- DATE_FORMAT =
'%F'.freeze
Constants inherited from StringValue
StringValue::ESCAPE_QUATE, StringValue::SINGLE_QUATE
Constants inherited from Abstract::Value
Abstract::Value::DIGIT_FORMAT, Abstract::Value::RANGE_FORMAT
Instance Attribute Summary
Attributes inherited from Abstract::Value
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(value, type = nil) ⇒ DateValue
constructor
A new instance of DateValue.
- #to_s ⇒ Object
Methods inherited from StringValue
Methods inherited from Abstract::Value
#==, #compile, datetime?, numeric?, range?, string_date?, string_datetime?, string_numeric?, string_range?, string_time?
Constructor Details
#initialize(value, type = nil) ⇒ DateValue
Returns a new instance of DateValue.
16 17 18 19 20 21 |
# File 'lib/cloud_sesame/query/ast/date_value.rb', line 16 def initialize(value, type = nil) value = Value.string_datetime?(value) ? parse_datetime(value) : Value.string_time?(value) ? parse_time(value) : Value.string_date?(value) ? parse_date(value) : value super(value, type) end |
Class Method Details
.parse(value) ⇒ Object
11 12 13 14 |
# File 'lib/cloud_sesame/query/ast/date_value.rb', line 11 def self.parse(value) return value.parse self if value.kind_of?(RangeValue) range?(value) || string_range?(value) ? RangeValue.new(value, self) : new(value) end |
Instance Method Details
#to_s ⇒ Object
23 24 25 |
# File 'lib/cloud_sesame/query/ast/date_value.rb', line 23 def to_s compile end |