Class: Bcome::Registry::Command::Shortcut

Inherits:
Base
  • Object
show all
Defined in:
lib/objects/registry/command/shortcut.rb

Instance Method Summary collapse

Methods inherited from Base

#defaults, #expected_keys, #initialize, is_valid_type?, #method_missing, new_from_raw_command, #process_arguments, valid_types, #validate, #validation_error

Constructor Details

This class inherits a constructor from Bcome::Registry::Command::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Bcome::Registry::Command::Base

Instance Method Details

#commandObject



15
16
17
# File 'lib/objects/registry/command/shortcut.rb', line 15

def command
  @data[:shortcut_command]
end

#execute(node, arguments) ⇒ Object

In which the bcome context is a shortcut to a more complex command



5
6
7
8
9
10
11
12
13
# File 'lib/objects/registry/command/shortcut.rb', line 5

def execute(node, arguments)  ## We'll add in arguments later
  if run_as_pseudo_tty?
    node.pseudo_tty command
  else
    node.run command
  end
rescue Interrupt
  puts "\nExiting gracefully from interrupt\n".warning
end

#run_as_pseudo_tty?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/objects/registry/command/shortcut.rb', line 19

def run_as_pseudo_tty?
  @data[:run_as_pseudo_tty]
end