Class: Shh::Command::ExecuteKey

Inherits:
Object
  • Object
show all
Includes:
KeyCommand
Defined in:
lib/shh/command/execute_key.rb

Instance Method Summary collapse

Methods included from KeyCommand

#completion, #initialize, #usage

Instance Method Details

#execute(key = nil) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/shh/command/execute_key.rb', line 10

def execute key=nil
  begin
    entry = @entry
    eval @entry[key]
  rescue Exception => e
    @io.say e.message
    e.backtrace.each {|t| @io.say " > #{t}" }
  end
end

#helpObject



6
7
8
# File 'lib/shh/command/execute_key.rb', line 6

def help
  "Executes the contents (ruby code) associated with the specified key\nNote that the entire entry is available as a hash called 'entry'"
end