Class: Dutchman::GhostWriter::AppleScript::Command
- Inherits:
-
Object
- Object
- Dutchman::GhostWriter::AppleScript::Command
- Defined in:
- lib/dutchman/ghost_writer/apple_script/command.rb
Overview
The Command class executes the provided AppleScript.
Instance Attribute Summary collapse
-
#applescript ⇒ Object
readonly
Returns the value of attribute applescript.
-
#container ⇒ Object
readonly
Returns the value of attribute container.
Instance Method Summary collapse
- #command_line ⇒ Object
- #command_line_template ⇒ Object
- #execute ⇒ Object
-
#initialize(container, applescript) ⇒ Command
constructor
A new instance of Command.
- #template_with_name(name) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(container, applescript) ⇒ Command
9 10 11 12 |
# File 'lib/dutchman/ghost_writer/apple_script/command.rb', line 9 def initialize(container,applescript) @container = container @applescript = applescript end |
Instance Attribute Details
#applescript ⇒ Object (readonly)
Returns the value of attribute applescript.
16 17 18 |
# File 'lib/dutchman/ghost_writer/apple_script/command.rb', line 16 def applescript @applescript end |
#container ⇒ Object (readonly)
Returns the value of attribute container.
14 15 16 |
# File 'lib/dutchman/ghost_writer/apple_script/command.rb', line 14 def container @container end |
Instance Method Details
#command_line ⇒ Object
26 27 28 |
# File 'lib/dutchman/ghost_writer/apple_script/command.rb', line 26 def command_line ERB.new(command_line_template).result(binding) end |
#command_line_template ⇒ Object
30 31 32 |
# File 'lib/dutchman/ghost_writer/apple_script/command.rb', line 30 def command_line_template template_with_name "command_line" end |
#execute ⇒ Object
22 23 24 |
# File 'lib/dutchman/ghost_writer/apple_script/command.rb', line 22 def execute container.execute(self) end |
#template_with_name(name) ⇒ Object
34 35 36 |
# File 'lib/dutchman/ghost_writer/apple_script/command.rb', line 34 def template_with_name(name) File.read(File.join(File.dirname(__FILE__),"#{name}.erb")) end |
#to_s ⇒ Object
18 19 20 |
# File 'lib/dutchman/ghost_writer/apple_script/command.rb', line 18 def to_s command_line end |