Class: Larynx::AppCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/larynx/command.rb

Instance Attribute Summary

Attributes inherited from Command

#command, #interrupted

Instance Method Summary collapse

Methods inherited from Command

#finalize, #interrupted?, #setup

Methods included from Callbacks

included

Constructor Details

#initialize(command, params = nil, options = {}, &block) ⇒ AppCommand

Returns a new instance of AppCommand.



64
65
66
67
# File 'lib/larynx/command.rb', line 64

def initialize(command, params=nil, options={}, &block)
  super command, params, &block
  @options = options.reverse_merge(:bargein => true)
end

Instance Method Details

#interruptable?Boolean

Returns:

  • (Boolean)


82
83
84
# File 'lib/larynx/command.rb', line 82

def interruptable?
  @options[:bargein]
end

#nameObject



69
70
71
# File 'lib/larynx/command.rb', line 69

def name
  "#{@command}#{" '#{@params}'" if @params}"
end

#to_sObject



73
74
75
76
77
78
79
80
# File 'lib/larynx/command.rb', line 73

def to_s
  cmd =  "sendmsg\n"
  cmd << "call-command: execute\n"
  cmd << "execute-app-name: #{@command}\n"
  cmd << "execute-app-arg: #{@params}\n" if @params
  cmd << "event-lock: #{@options[:lock]}\n" if @options[:lock]
  cmd << "\n"
end