lib/timeliness/format_set.rb in timeliness-0.1.1 vs lib/timeliness/format_set.rb in timeliness-0.2.0

- old
+ new

@@ -46,11 +46,11 @@ # Compiles a format method which maps the regexp capture groups to method # arguments based on order captured. A time array is built using the argument # values placed in the position defined by the component. # def define_format_method(name, components) - values = [nil] * 7 + values = [nil] * 8 components.each do |component| position, code = *Formats.format_components[component] values[position] = code || "#{component}.to_i" if position end class_eval <<-DEF @@ -64,9 +64,13 @@ def initialize(formats) @formats = formats end + # Compiles the formats into one big regexp. Stores the index of where + # each format's capture values begin in the match data. Each individual + # format regpexp is also stored for use with the parse :format option. + # def compile! regexp_string = '' @format_regexps = {} @match_indexes = {} @formats.inject(0) { |index, format|