Class: RubyJard::Commands::FilterCommand
- Inherits:
-
Pry::ClassCommand
- Object
- Pry::ClassCommand
- RubyJard::Commands::FilterCommand
- Includes:
- ColorHelpers
- Defined in:
- lib/ruby_jard/commands/jard/filter_command.rb
Overview
Control filter, included and excluded
Instance Method Summary collapse
-
#initialize(*args) ⇒ FilterCommand
constructor
A new instance of FilterCommand.
- #process ⇒ Object
Methods included from ColorHelpers
#color_decorator, #highlight, #pick_color_scheme, #secondary, #special
Constructor Details
#initialize(*args) ⇒ FilterCommand
Returns a new instance of FilterCommand.
48 49 50 51 52 |
# File 'lib/ruby_jard/commands/jard/filter_command.rb', line 48 def initialize(*args) super(*args) @filters = RubyJard::PathFilter::FILTERS @config = context[:config] || RubyJard.config end |
Instance Method Details
#process ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/ruby_jard/commands/jard/filter_command.rb', line 54 def process if args.empty? print_current_filter return end sub_command = args.shift.to_sym case sub_command when *@filters @config.filter = sub_command RubyJard::ControlFlow.dispatch(:list) when :include handle_included when :exclude handle_excluded when :clear handle_clear else raise Pry::CommandError, "Invalid filter '#{secondary(sub_command)}'."\ "Please type `#{highlight('jard filter --help')}` for more information" end end |