module EnumBehavior
Constants
- VERSION
Public Instance Methods
enum_behavior(enum_name)
click to toggle source
# File lib/enum_behavior.rb, line 11 def enum_behavior(enum_name) behavior_name = "#{enum_name}_behavior" define_method(behavior_name) do current = public_send(enum_name) return nil if current.nil? class_name = "#{self.class.name.pluralize}::#{current.camelize}" class_name.constantize.new(self) end end