Module: Flexr::Configuration
- Defined in:
- lib/flexr/configuration.rb
Constant Summary collapse
- BACKENDS =
%i[table direct firstmatch auto].freeze
- TOKEN_KINDS =
%i[array struct yield].freeze
- ACCELERATORS =
%i[auto strscan regexp none].freeze
- BOOLEAN_OPTIONS =
%i[unicode eager_columns allow_empty_match experimental standalone].freeze
Class Method Summary collapse
- .accelerator!(value) ⇒ Object
- .backend!(value) ⇒ Object
- .option!(value) ⇒ Object
- .token_kind!(value) ⇒ Object
- .validated_symbol!(value, allowed, name) ⇒ Object
Class Method Details
.accelerator!(value) ⇒ Object
20 21 22 |
# File 'lib/flexr/configuration.rb', line 20 def accelerator!(value) validated_symbol!(value, ACCELERATORS, :accel) end |
.backend!(value) ⇒ Object
12 13 14 |
# File 'lib/flexr/configuration.rb', line 12 def backend!(value) validated_symbol!(value, BACKENDS, :backend) end |
.option!(value) ⇒ Object
24 25 26 |
# File 'lib/flexr/configuration.rb', line 24 def option!(value) validated_symbol!(value, BOOLEAN_OPTIONS, :option) end |
.token_kind!(value) ⇒ Object
16 17 18 |
# File 'lib/flexr/configuration.rb', line 16 def token_kind!(value) validated_symbol!(value, TOKEN_KINDS, :token_kind) end |
.validated_symbol!(value, allowed, name) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/flexr/configuration.rb', line 28 def validated_symbol!(value, allowed, name) symbol = value.to_sym return symbol if allowed.include?(symbol) raise ArgumentError, "unsupported #{name}: #{value.inspect}" rescue NoMethodError raise ArgumentError, "unsupported #{name}: #{value.inspect}" end |