Class: Narabikae::Option

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(field:, key_max_size:, scope: []) ⇒ Option

Initializes a new instance of the Option class.

Parameters:

  • field (Symbol)
  • key_max_size (Integer)

    The maximum size of the key.

  • scope (Array<Symbol>) (defaults to: [])

    The scope of the option.



10
11
12
13
14
# File 'lib/narabikae/option.rb', line 10

def initialize(field:, key_max_size:, scope: [])
  @field = field.to_sym
  @key_max_size = key_max_size.to_i
  @scope = scope.is_a?(Array) ? scope.map(&:to_sym) : []
end

Instance Attribute Details

#fieldObject (readonly)

Returns the value of attribute field.



3
4
5
# File 'lib/narabikae/option.rb', line 3

def field
  @field
end

#key_max_sizeObject (readonly)

Returns the value of attribute key_max_size.



3
4
5
# File 'lib/narabikae/option.rb', line 3

def key_max_size
  @key_max_size
end

#scopeObject (readonly)

Returns the value of attribute scope.



3
4
5
# File 'lib/narabikae/option.rb', line 3

def scope
  @scope
end