Class: Narabikae::Option
- Inherits:
-
Object
- Object
- Narabikae::Option
- Defined in:
- lib/narabikae/option.rb
Instance Attribute Summary collapse
-
#default_position ⇒ Object
readonly
Returns the value of attribute default_position.
-
#field ⇒ Object
readonly
Returns the value of attribute field.
-
#key_max_size ⇒ Object
readonly
Returns the value of attribute key_max_size.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
Instance Method Summary collapse
-
#initialize(field:, key_max_size:, scope: [], default_position: :last) ⇒ Option
constructor
Initializes a new instance of the Option class.
Constructor Details
#initialize(field:, key_max_size:, scope: [], default_position: :last) ⇒ Option
Initializes a new instance of the Option class.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/narabikae/option.rb', line 11 def initialize(field:, key_max_size:, scope: [], default_position: :last) @field = field.to_sym @key_max_size = key_max_size.to_i @scope = Array.wrap(scope).map(&:to_sym) @default_position = (default_position || :last).to_sym unless i[first last].include?(@default_position) raise ArgumentError, "default_position must be :first or :last" end end |
Instance Attribute Details
#default_position ⇒ Object (readonly)
Returns the value of attribute default_position.
3 4 5 |
# File 'lib/narabikae/option.rb', line 3 def default_position @default_position end |
#field ⇒ Object (readonly)
Returns the value of attribute field.
3 4 5 |
# File 'lib/narabikae/option.rb', line 3 def field @field end |
#key_max_size ⇒ Object (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 |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
3 4 5 |
# File 'lib/narabikae/option.rb', line 3 def scope @scope end |