Module: BitmaskAttribute::ClassMethods

Defined in:
lib/bitmask_attribute.rb

Instance Method Summary collapse

Instance Method Details

#bitmask(attribute, options = {}, &extension) ⇒ Object



136
137
138
139
140
141
142
# File 'lib/bitmask_attribute.rb', line 136

def bitmask(attribute, options={}, &extension)
  unless options[:as] && options[:as].kind_of?(Array)
    raise ArgumentError, "Must provide an Array :as option"
  end
  bitmask_definitions[attribute] = BitmaskAttribute::Definition.new(attribute, options[:as].to_a, &extension)
  bitmask_definitions[attribute].install_on(self)
end

#bitmask_definitionsObject



144
145
146
# File 'lib/bitmask_attribute.rb', line 144

def bitmask_definitions
  @bitmask_definitions ||= {}
end

#bitmasksObject



148
149
150
# File 'lib/bitmask_attribute.rb', line 148

def bitmasks
  @bitmasks ||= {}
end