Class: Flexr::Options
- Inherits:
-
Struct
- Object
- Struct
- Flexr::Options
- Defined in:
- lib/flexr/options.rb
Instance Attribute Summary collapse
-
#accel ⇒ Object
Returns the value of attribute accel.
-
#backend ⇒ Object
Returns the value of attribute backend.
-
#color ⇒ Object
Returns the value of attribute color.
-
#eval_mode ⇒ Object
Returns the value of attribute eval_mode.
-
#format ⇒ Object
Returns the value of attribute format.
-
#max_dfa_states ⇒ Object
Returns the value of attribute max_dfa_states.
-
#overrides ⇒ Object
Returns the value of attribute overrides.
-
#standalone ⇒ Object
Returns the value of attribute standalone.
-
#table_compression ⇒ Object
Returns the value of attribute table_compression.
-
#table_format ⇒ Object
Returns the value of attribute table_format.
-
#token_kind ⇒ Object
Returns the value of attribute token_kind.
-
#warn_as_error ⇒ Object
Returns the value of attribute warn_as_error.
-
#warn_level ⇒ Object
Returns the value of attribute warn_level.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#accel ⇒ Object
Returns the value of attribute accel
6 7 8 |
# File 'lib/flexr/options.rb', line 6 def accel @accel end |
#backend ⇒ Object
Returns the value of attribute backend
6 7 8 |
# File 'lib/flexr/options.rb', line 6 def backend @backend end |
#color ⇒ Object
Returns the value of attribute color
6 7 8 |
# File 'lib/flexr/options.rb', line 6 def color @color end |
#eval_mode ⇒ Object
Returns the value of attribute eval_mode
6 7 8 |
# File 'lib/flexr/options.rb', line 6 def eval_mode @eval_mode end |
#format ⇒ Object
Returns the value of attribute format
6 7 8 |
# File 'lib/flexr/options.rb', line 6 def format @format end |
#max_dfa_states ⇒ Object
Returns the value of attribute max_dfa_states
6 7 8 |
# File 'lib/flexr/options.rb', line 6 def max_dfa_states @max_dfa_states end |
#overrides ⇒ Object
Returns the value of attribute overrides
6 7 8 |
# File 'lib/flexr/options.rb', line 6 def overrides @overrides end |
#standalone ⇒ Object
Returns the value of attribute standalone
6 7 8 |
# File 'lib/flexr/options.rb', line 6 def standalone @standalone end |
#table_compression ⇒ Object
Returns the value of attribute table_compression
6 7 8 |
# File 'lib/flexr/options.rb', line 6 def table_compression @table_compression end |
#table_format ⇒ Object
Returns the value of attribute table_format
6 7 8 |
# File 'lib/flexr/options.rb', line 6 def table_format @table_format end |
#token_kind ⇒ Object
Returns the value of attribute token_kind
6 7 8 |
# File 'lib/flexr/options.rb', line 6 def token_kind @token_kind end |
#warn_as_error ⇒ Object
Returns the value of attribute warn_as_error
6 7 8 |
# File 'lib/flexr/options.rb', line 6 def warn_as_error @warn_as_error end |
#warn_level ⇒ Object
Returns the value of attribute warn_level
6 7 8 |
# File 'lib/flexr/options.rb', line 6 def warn_level @warn_level end |
Class Method Details
.default ⇒ Object
11 12 13 14 15 16 |
# File 'lib/flexr/options.rb', line 11 def self.default new(backend: :table, token_kind: :array, accel: :auto, standalone: false, eval_mode: false, table_compression: :rows, table_format: :literal, max_dfa_states: 100_000, warn_level: :default, warn_as_error: false, color: :auto, format: :human, overrides: {}) end |
Instance Method Details
#generator_options ⇒ Object
37 38 39 |
# File 'lib/flexr/options.rb', line 37 def (overrides || {}).merge(warn_as_error: warn_as_error, color: color) end |
#set(name, value) ⇒ Object
18 19 20 21 22 |
# File 'lib/flexr/options.rb', line 18 def set(name, value) self[name] = value self.overrides ||= {} overrides[name] = value end |
#validate! ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/flexr/options.rb', line 24 def validate! validate_value!(backend, Configuration::BACKENDS, :backend) validate_value!(token_kind, Configuration::TOKEN_KINDS, :token_kind) validate_value!(accel, Configuration::ACCELERATORS, :accel) validate_value!(table_compression, %i[none rows full], :table_compression) validate_value!(table_format, %i[literal packed], :table_format) validate_value!(warn_level, %i[all default none], :warn_level) validate_value!(color, %i[auto always never], :color) validate_value!(format, %i[human json], :format) raise ArgumentError, "unsupported max_dfa_states: #{max_dfa_states.inspect}" unless max_dfa_states.is_a?(Integer) && max_dfa_states.positive? self end |