Class: Bookwatch::Commands::Components::CommandOptions
- Inherits:
-
Object
- Object
- Bookwatch::Commands::Components::CommandOptions
- Defined in:
- lib/bookwatch/commands/components/command_options.rb
Instance Method Summary collapse
- #bind_source ⇒ Object
-
#initialize(opts, base_streams, verbose = false) ⇒ CommandOptions
constructor
A new instance of CommandOptions.
- #local_repo_dir ⇒ Object
- #options ⇒ Object
- #ref_override ⇒ Object
- #streams ⇒ Object
Constructor Details
#initialize(opts, base_streams, verbose = false) ⇒ CommandOptions
Returns a new instance of CommandOptions.
10 11 12 13 14 |
# File 'lib/bookwatch/commands/components/command_options.rb', line 10 def initialize(opts, base_streams, verbose = false) @opts = opts @base_streams = base_streams @verbosity = verbose end |
Instance Method Details
#bind_source ⇒ Object
16 17 18 |
# File 'lib/bookwatch/commands/components/command_options.rb', line 16 def bind_source opts.first end |
#local_repo_dir ⇒ Object
20 21 22 |
# File 'lib/bookwatch/commands/components/command_options.rb', line 20 def local_repo_dir File.('..') if bind_source == 'local' end |
#options ⇒ Object
24 25 26 |
# File 'lib/bookwatch/commands/components/command_options.rb', line 24 def opts[1..-1] end |
#ref_override ⇒ Object
28 29 30 |
# File 'lib/bookwatch/commands/components/command_options.rb', line 28 def ref_override 'master' if .include?('--ignore-section-refs') end |
#streams ⇒ Object
32 33 34 35 36 37 |
# File 'lib/bookwatch/commands/components/command_options.rb', line 32 def streams base_streams.merge( out: verbosity ? base_streams[:out] : Streams::FilterStream.new(/^(?:\s*error|Invalid CSS|Undefined mixin|\/)/i, Streams::ColorizedStream.new(Colorizer::Colors.red, base_streams[:out])), ) end |