lib/state_objects/base.rb in state_objects-0.9.1 vs lib/state_objects/base.rb in state_objects-0.9.2
- old
+ new
@@ -1,14 +1,18 @@
module StateObjects
+
+ class Error < RuntimeError
+ end
+
class Base
def initialize(model)
@model = model
end
def self.state_object_values(*opts) # :nodoc:
unless opts.size == 3
- raise @model.to_s + "#state_object_values Must have 3 arguments: symbol, db_value, label. For Example: state_object_values :red,'R','Dont Walk'"
+ raise StateObjects::Error.new @model.to_s + "#state_object_values Must have 3 arguments: symbol, db_value, label. For Example: state_object_values :red,'R','Dont Walk'"
end
class_eval <<-EOF
def self.symbol
'#{opts[0]}'.to_sym