Class: BitmaskEnum::Options Private

Inherits:
Object
  • Object
show all
Defined in:
lib/bitmask_enum/options.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.

Handles the bitmask enum’s user-provided options

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Options

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 Options.



11
12
13
14
15
16
17
18
19
20
# File 'lib/bitmask_enum/options.rb', line 11

def initialize(options)
  @nil_handling = options[:nil_handling].to_sym
  unless NIL_HANDLING_OPTIONS.include?(@nil_handling)
    raise BitmaskEnumInvalidError, "#{@nil_handling} is not a valid nil handling option"
  end

  @flag_prefix = options[:flag_prefix].nil? ? '' : "#{options[:flag_prefix]}_"
  @flag_suffix = options[:flag_suffix].nil? ? '' : "_#{options[:flag_suffix]}"
  @validate = options[:validate]
end

Instance Attribute Details

#flag_prefixObject (readonly)

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.



9
10
11
# File 'lib/bitmask_enum/options.rb', line 9

def flag_prefix
  @flag_prefix
end

#flag_suffixObject (readonly)

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.



9
10
11
# File 'lib/bitmask_enum/options.rb', line 9

def flag_suffix
  @flag_suffix
end

#nil_handlingObject (readonly)

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.



9
10
11
# File 'lib/bitmask_enum/options.rb', line 9

def nil_handling
  @nil_handling
end

#validateObject (readonly)

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.



9
10
11
# File 'lib/bitmask_enum/options.rb', line 9

def validate
  @validate
end