Class: CodelessCode::Filters::FromOptions
- Extended by:
- Forwardable
- Defined in:
- lib/codeless_code/filters/from_options.rb
Overview
A Composite filter build from the arguments supplied via the CLI.
Instance Method Summary collapse
- #enabled? ⇒ Boolean
- #filters ⇒ Object
-
#initialize(opts) ⇒ FromOptions
constructor
A new instance of FromOptions.
- #lang ⇒ Object
Methods inherited from Composite
Constructor Details
#initialize(opts) ⇒ FromOptions
Returns a new instance of FromOptions.
28 29 30 31 |
# File 'lib/codeless_code/filters/from_options.rb', line 28 def initialize(opts) @opts = opts @filters = nil end |
Instance Method Details
#enabled? ⇒ Boolean
37 38 39 |
# File 'lib/codeless_code/filters/from_options.rb', line 37 def enabled? @opts.key?(:lang) || non_defaults_enabled? end |
#filters ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/codeless_code/filters/from_options.rb', line 41 def filters @filters ||= string_filters + integer_filters + [ filter(:Date, :date), new_filter(:Lang, exact: lang), number_filter, translator_filter ] end |
#lang ⇒ Object
33 34 35 |
# File 'lib/codeless_code/filters/from_options.rb', line 33 def lang @opts[:lang]&.to_sym || fallback_lang end |