lib/timeliness/format.rb in timeliness-0.3.7 vs lib/timeliness/format.rb in timeliness-0.3.8
- old
+ new
@@ -1,11 +1,11 @@
module Timeliness
- class CompilationError < StandardError; end
-
class Format
include Helpers
+ CompilationFailed = Class.new(StandardError)
+
attr_reader :format_string, :regexp, :regexp_string, :token_count
def initialize(format_string)
@format_string = format_string
end
@@ -39,10 +39,10 @@
define_process_method(token_order.compact)
@regexp_string = format
@regexp = Regexp.new("^(#{format})$")
self
rescue => ex
- raise CompilationError, "The format '#{format_string}' failed to compile using regexp string #{format}. Error message: #{ex.inspect}"
+ raise CompilationFailed, "The format '#{format_string}' failed to compile using regexp string #{format}. Error message: #{ex.inspect}"
end
# Redefined on compile
def process(*args); end