Class: Space::Source::Command
- Inherits:
-
Object
- Object
- Space::Source::Command
- Defined in:
- lib/space/source/command.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
Returns the value of attribute command.
-
#key ⇒ Object
Returns the value of attribute key.
-
#source ⇒ Object
Returns the value of attribute source.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(source, key, command) ⇒ Command
constructor
A new instance of Command.
- #refresh ⇒ Object
Constructor Details
#initialize(source, key, command) ⇒ Command
Returns a new instance of Command.
16 17 18 19 20 |
# File 'lib/space/source/command.rb', line 16 def initialize(source, key, command) @source = source @key = key @command = command end |
Instance Attribute Details
#command ⇒ Object
Returns the value of attribute command.
14 15 16 |
# File 'lib/space/source/command.rb', line 14 def command @command end |
#key ⇒ Object
Returns the value of attribute key.
14 15 16 |
# File 'lib/space/source/command.rb', line 14 def key @key end |
#source ⇒ Object
Returns the value of attribute source.
14 15 16 |
# File 'lib/space/source/command.rb', line 14 def source @source end |
Class Method Details
.execute(dir, command) ⇒ Object
8 9 10 11 |
# File 'lib/space/source/command.rb', line 8 def execute(dir, command) log "#{File.basename(dir)} $ #{command}" Open3.capture2e("cd #{dir}; #{command}").first end |
Instance Method Details
#refresh ⇒ Object
22 23 24 |
# File 'lib/space/source/command.rb', line 22 def refresh Thread.new(&method(:run)) end |