Class: Input::Shell
- Inherits:
-
Object
- Object
- Input::Shell
- Defined in:
- lib/xify/input/shell.rb
Instance Method Summary collapse
-
#initialize(config) ⇒ Shell
constructor
A new instance of Shell.
- #run {|Xify::Event.new @config['author'], out, parent: @config['shell']| ... } ⇒ Object
- #updates(&block) ⇒ Object
Constructor Details
#initialize(config) ⇒ Shell
Returns a new instance of Shell.
3 4 5 |
# File 'lib/xify/input/shell.rb', line 3 def initialize(config) @config = config end |
Instance Method Details
#run {|Xify::Event.new @config['author'], out, parent: @config['shell']| ... } ⇒ Object
7 8 9 10 |
# File 'lib/xify/input/shell.rb', line 7 def run out = `#{@config['shell']}`.chomp yield Xify::Event.new @config['author'], out, parent: @config['shell'] if out && out.length != 0 end |
#updates(&block) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/xify/input/shell.rb', line 12 def updates(&block) return run(&block) unless @config['trigger'] opts = {} opts[:first] = :now if @config['trigger']['now'] Rufus::Scheduler.singleton.repeat @config['trigger']['schedule'], opts do run(&block) end end |