Class: Birddog::DateExpression
- Inherits:
-
Object
- Object
- Birddog::DateExpression
- Defined in:
- lib/birddog/date_expression.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(value) ⇒ DateExpression
constructor
A new instance of DateExpression.
- #to_s ⇒ Object
Constructor Details
#initialize(value) ⇒ DateExpression
Returns a new instance of DateExpression.
6 7 8 9 10 |
# File 'lib/birddog/date_expression.rb', line 6 def initialize(value) value.gsub!(/\s/, '') parts = value.scan(/(?:[=<>]+|(?:[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}))/)[0,2] @value = Date.parse(Chronic.parse(parts.last).to_s) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
4 5 6 |
# File 'lib/birddog/date_expression.rb', line 4 def value @value end |
Instance Method Details
#to_s ⇒ Object
12 13 14 |
# File 'lib/birddog/date_expression.rb', line 12 def to_s @value.to_s end |