Class: DateMolder::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/date_molder/parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(str, formats) ⇒ Parser

Returns a new instance of Parser.



5
6
7
8
9
10
11
# File 'lib/date_molder/parser.rb', line 5

def initialize(str, formats)
  @str = str
  @init = str.dup
  @formats = formats
  @solutions= []
  @parsed_time = Time.parse(str)
end

Instance Attribute Details

#formatsObject

Returns the value of attribute formats.



3
4
5
# File 'lib/date_molder/parser.rb', line 3

def formats
  @formats
end

#initObject

Returns the value of attribute init.



3
4
5
# File 'lib/date_molder/parser.rb', line 3

def init
  @init
end

#parsed_timeObject

Returns the value of attribute parsed_time.



3
4
5
# File 'lib/date_molder/parser.rb', line 3

def parsed_time
  @parsed_time
end

#solutionsObject

Returns the value of attribute solutions.



3
4
5
# File 'lib/date_molder/parser.rb', line 3

def solutions
  @solutions
end

Instance Method Details

#parseObject



13
14
15
# File 'lib/date_molder/parser.rb', line 13

def parse
  parse_internal(@str, 0)
end