Class: BitmaskAttribute::Definition
Instance Attribute Summary collapse
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
-
#extension ⇒ Object
readonly
Returns the value of attribute extension.
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Instance Method Summary collapse
-
#initialize(attribute, values = [], &extension) ⇒ Definition
constructor
A new instance of Definition.
- #install_on(model) ⇒ Object
Constructor Details
#initialize(attribute, values = [], &extension) ⇒ Definition
Returns a new instance of Definition.
11 12 13 14 15 |
# File 'lib/bitmask_attribute.rb', line 11 def initialize(attribute, values=[], &extension) @attribute = attribute @values = values @extension = extension end |
Instance Attribute Details
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
10 11 12 |
# File 'lib/bitmask_attribute.rb', line 10 def attribute @attribute end |
#extension ⇒ Object (readonly)
Returns the value of attribute extension.
10 11 12 |
# File 'lib/bitmask_attribute.rb', line 10 def extension @extension end |
#values ⇒ Object (readonly)
Returns the value of attribute values.
10 11 12 |
# File 'lib/bitmask_attribute.rb', line 10 def values @values end |
Instance Method Details
#install_on(model) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/bitmask_attribute.rb', line 17 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_named_scopes_on(model) if defined?(ActiveRecord::Base) && model.respond_to?(scope_method) end |