lib/timeliness/format.rb in timeliness-0.4.5 vs lib/timeliness/format.rb in timeliness-0.5.0

- old
+ new

@@ -44,11 +44,11 @@ token_regexp_str end define_process_method(token_order.compact) @regexp_string = format - @regexp = Regexp.new("^(#{format})$") + @regexp = Regexp.new("^(?>#{format})$") self rescue => ex raise CompilationFailed, "The format '#{format_string}' failed to compile using regexp string #{format}. Error message: #{ex.inspect}" end @@ -61,9 +61,10 @@ values = [nil] * 8 components.each do |component| position, code = Definitions.format_components[component] values[position] = code || "#{component}.to_i" if position end + components << '*_' # absorb any excess arguments not used by format instance_eval <<-DEF def process(#{components.join(',')}) [#{values.map { |i| i || 'nil' }.join(',')}] end DEF