Commit 4b6796aa authored by Ash McKenzie's avatar Ash McKenzie

Strip KeyCollisionError's implementation

parent e6efedc9
......@@ -76,11 +76,7 @@ module DeclarativeEnum
end
class Builder
class KeyCollisionError < StandardError
def initialize(key)
super("`#{key}` collides with an existing enum key!")
end
end
KeyCollisionError = Class.new(StandardError)
def initialize(definition, block)
@definition = definition
......@@ -96,7 +92,7 @@ module DeclarativeEnum
private
def method_missing(name, *arguments, value: nil, description: nil, &block)
raise KeyCollisionError.new(name) if @definition[name.downcase.to_sym]
raise KeyCollisionError, "'#{key}' collides with an existing enum key!" if @definition[name.downcase.to_sym]
@definition[name.downcase.to_sym] = {
value: value,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment