Class: Pechkin::Command::SendData
- Defined in:
- lib/pechkin/command/send_data.rb
Overview
Send data to channel and exit. Uses --preview flag to render message and flush it to STDOUT before sending
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#configuration, #handler, #initialize, #puts, #warn
Constructor Details
This class inherits a constructor from Pechkin::Command::Base
Instance Method Details
#execute ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/pechkin/command/send_data.rb', line 10 def execute ch, msg = parse_endpoint(.send_data) raise "#{ch}/#{msg} not found" unless handler.(ch, msg) data = read_data(.data) if .preview puts handler.preview(ch, msg, data) else handler.handle(ch, msg, data).each do |e| puts "* #{e.inspect}" end end end |
#matches? ⇒ Boolean
6 7 8 |
# File 'lib/pechkin/command/send_data.rb', line 6 def matches? .send_data end |