Module: BitmaskAttribute::ClassMethods

Defined in:
lib/bitmask_attribute.rb

Instance Method Summary collapse

Instance Method Details

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



141
142
143
144
145
146
147
# File 'lib/bitmask_attribute.rb', line 141

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



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

def bitmask_definitions
  @bitmask_definitions ||= {}
end

#bitmasksObject



153
154
155
# File 'lib/bitmask_attribute.rb', line 153

def bitmasks
  @bitmasks ||= {}
end