Class: BitmaskEnum::Attribute Private
- Inherits:
-
Object
- Object
- BitmaskEnum::Attribute
- Defined in:
- lib/bitmask_enum/attribute.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constructs the magic methods and overrides getters and setters for a bitmask enum attribute
Instance Method Summary collapse
-
#construct! ⇒ Object
private
Defines the methods for the attribute.
-
#initialize(model, attribute, flags, options, defined_enum_methods) ⇒ Attribute
constructor
private
A new instance of Attribute.
Constructor Details
#initialize(model, attribute, flags, options, defined_enum_methods) ⇒ Attribute
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Attribute.
12 13 14 15 16 17 18 19 |
# File 'lib/bitmask_enum/attribute.rb', line 12 def initialize(model, attribute, flags, , defined_enum_methods) @attribute = attribute @flags = flags @options = Options.new() @nil_handler = NilHandler.new(@options.nil_handling) @model = model @conflict_checker = ConflictChecker.new(model, attribute, defined_enum_methods) end |
Instance Method Details
#construct! ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Defines the methods for the attribute
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/bitmask_enum/attribute.rb', line 22 def construct! attribute_validation if @options.validate @flags.each_with_index do |flag, flag_index| per_flag_methods("#{@options.flag_prefix}#{flag}#{@options.flag_suffix}", flag_index) end flag_settings_hash_method flag_getter_method flag_setter_method dynamic_any_enabled_scope dynamic_any_disabled_scope dynamic_all_enabled_scope dynamic_all_disabled_scope class_flag_values_method end |