Module: RainCity::Has::BitFlags::ClassMethods
- Defined in:
- lib/has_flags.rb
Overview
declare the class method “has_flags” create the instance methods based on bitflags and options
Instance Method Summary collapse
Instance Method Details
#has_flags(bitflags, options = { }) ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/has_flags.rb', line 69 def has_flags(bitflags, = { }) unless respond_to? :bitflag_attr class_eval { cattr_accessor :bitflag_column, :bitflags, :default_mask } # use config to lookup these values self.bitflag_column, self.bitflags, self.default_mask = 'bit_flags', { }, 0 end create_accessors bitflags # now declare the class Singleton methods class_eval { extend RainCity::Has::BitFlags::BitFlagMethods } end |