Class: BitmaskAttributes::Definition
- Inherits:
-
Object
- Object
- BitmaskAttributes::Definition
- Defined in:
- lib/bitmask_attributes/definition.rb
Instance Attribute Summary collapse
-
#allow_null ⇒ Object
readonly
Returns the value of attribute allow_null.
-
#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.
-
#zero_value ⇒ Object
readonly
Returns the value of attribute zero_value.
Instance Method Summary collapse
-
#initialize(attribute, values = [], allow_null = true, zero_value = nil, &extension) ⇒ Definition
constructor
A new instance of Definition.
- #install_on(model) ⇒ Object
Constructor Details
#initialize(attribute, values = [], allow_null = true, zero_value = nil, &extension) ⇒ Definition
Returns a new instance of Definition.
5 6 7 8 9 10 11 |
# File 'lib/bitmask_attributes/definition.rb', line 5 def initialize(attribute, values=[], allow_null = true, zero_value = nil, &extension) @attribute = attribute @values = values @extension = extension @allow_null = allow_null @zero_value = zero_value end |
Instance Attribute Details
#allow_null ⇒ Object (readonly)
Returns the value of attribute allow_null.
3 4 5 |
# File 'lib/bitmask_attributes/definition.rb', line 3 def allow_null @allow_null end |
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
3 4 5 |
# File 'lib/bitmask_attributes/definition.rb', line 3 def attribute @attribute end |
#extension ⇒ Object (readonly)
Returns the value of attribute extension.
3 4 5 |
# File 'lib/bitmask_attributes/definition.rb', line 3 def extension @extension end |
#values ⇒ Object (readonly)
Returns the value of attribute values.
3 4 5 |
# File 'lib/bitmask_attributes/definition.rb', line 3 def values @values end |
#zero_value ⇒ Object (readonly)
Returns the value of attribute zero_value.
3 4 5 |
# File 'lib/bitmask_attributes/definition.rb', line 3 def zero_value @zero_value end |
Instance Method Details
#install_on(model) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/bitmask_attributes/definition.rb', line 13 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 create_attribute_methods_on model end |