Class: Parser
- Inherits:
-
Object
- Object
- Parser
- Defined in:
- lib/tempus/parser.rb
Overview
Parser others types to value
Instance Method Summary collapse
-
#initialize(only_hours: true) ⇒ Parser
constructor
A new instance of Parser.
- #parse(value) ⇒ Object
Constructor Details
#initialize(only_hours: true) ⇒ Parser
Returns a new instance of Parser.
5 6 7 |
# File 'lib/tempus/parser.rb', line 5 def initialize(only_hours: true) @only_hours = only_hours end |
Instance Method Details
#parse(value) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/tempus/parser.rb', line 9 def parse(value) @value = value case @value when String from_string.to_f when Time from_time.to_f else @value.to_f end end |