Class: TecDoc::DateParser
- Inherits:
-
Object
- Object
- TecDoc::DateParser
- Defined in:
- lib/tec_doc/date_parser.rb
Instance Method Summary collapse
-
#initialize(value) ⇒ DateParser
constructor
A new instance of DateParser.
- #to_date ⇒ Object
Constructor Details
#initialize(value) ⇒ DateParser
Returns a new instance of DateParser.
3 4 5 |
# File 'lib/tec_doc/date_parser.rb', line 3 def initialize(value) @value = value end |
Instance Method Details
#to_date ⇒ Object
7 8 9 10 11 12 |
# File 'lib/tec_doc/date_parser.rb', line 7 def to_date if @value year, month = @value.to_i.divmod(100) Date.new(year, month, 1) end end |