lib/abstractivator/enum.rb in abstractivator-0.0.20 vs lib/abstractivator/enum.rb in abstractivator-0.0.21
- old
+ new
@@ -19,9 +19,13 @@
def from_symbol(sym)
safe_constantize("#{self.name}::#{sym.to_s.upcase}")
end
+ def from(x)
+ values.find{|v| v == x}
+ end
+
private
def safe_constantize(str)
begin
str.constantize