Class: BitmaskAttribute::Definition

Inherits:
Object
  • Object
show all
Defined in:
lib/bitmask_attribute.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attribute, values = [], &extension) ⇒ Definition

Returns a new instance of Definition.



8
9
10
11
12
# File 'lib/bitmask_attribute.rb', line 8

def initialize(attribute, values=[], &extension)
  @attribute = attribute
  @values = values
  @extension = extension
end

Instance Attribute Details

#attributeObject (readonly)

Returns the value of attribute attribute.



7
8
9
# File 'lib/bitmask_attribute.rb', line 7

def attribute
  @attribute
end

#extensionObject (readonly)

Returns the value of attribute extension.



7
8
9
# File 'lib/bitmask_attribute.rb', line 7

def extension
  @extension
end

#valuesObject (readonly)

Returns the value of attribute values.



7
8
9
# File 'lib/bitmask_attribute.rb', line 7

def values
  @values
end

Instance Method Details

#install_on(model) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/bitmask_attribute.rb', line 14

def install_on(model)
  validate_for model
  generate_bitmasks_on model
  override model
  create_convenience_class_method_on(model)
  create_convenience_instance_methods_on(model)
  create_scopes_on(model)
end