Class: RubyJard::Commands::HideCommand
- Inherits:
-
Pry::ClassCommand
- Object
- Pry::ClassCommand
- RubyJard::Commands::HideCommand
- Defined in:
- lib/ruby_jard/commands/jard/hide_command.rb
Overview
Show a screen
Instance Method Summary collapse
-
#initialize(context = {}) ⇒ HideCommand
constructor
A new instance of HideCommand.
- #process ⇒ Object
Constructor Details
#initialize(context = {}) ⇒ HideCommand
Returns a new instance of HideCommand.
14 15 16 17 18 19 |
# File 'lib/ruby_jard/commands/jard/hide_command.rb', line 14 def initialize(context = {}) super(context) @screens = context[:screens] || RubyJard::Screens @config = context[:config] || RubyJard.config end |
Instance Method Details
#process ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/ruby_jard/commands/jard/hide_command.rb', line 21 def process screen = args.first.to_s.strip if screen.empty? raise Pry::CommandError, "Please input one of the following: #{@screens.names.join(', ')}" end unless @screens.names.include?(screen) raise Pry::CommandError, "Screen `#{screen}` not found. Please input one of the following: #{@screens.names.join(', ')}" end @config.enabled_screens.delete(screen) RubyJard::ControlFlow.dispatch(:list) end |