Commit 481cad2c authored by Ash McKenzie's avatar Ash McKenzie

DRY up the creation of key

parent 4b6796aa
......@@ -92,9 +92,10 @@ module DeclarativeEnum
private
def method_missing(name, *arguments, value: nil, description: nil, &block)
raise KeyCollisionError, "'#{key}' collides with an existing enum key!" if @definition[name.downcase.to_sym]
key = name.downcase.to_sym
raise KeyCollisionError, "'#{key}' collides with an existing enum key!" if @definition[key]
@definition[name.downcase.to_sym] = {
@definition[key] = {
value: value,
description: description
}
......
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