Class: TecDoc::DateParser

Inherits:
Object
  • Object
show all
Defined in:
lib/tec_doc/date_parser.rb

Instance Method Summary collapse

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_dateObject



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