Class: Arpie::ShellwordsProtocol
- Defined in:
- lib/arpie/protocol.rb
Overview
A linebased-protocol, which does shellwords-escaping/joining on the lines; messages sent are arrays of parameters. Note that all parameters are expected to be strings.
Constant Summary
Constants inherited from Protocol
Protocol::CAN_SEPARATE_MESSAGES
Instance Method Summary collapse
Methods inherited from Protocol
#again!, #assemble, #assemble!, #bogon!, #gulp!, #incomplete!
Instance Method Details
#from(binary) {|Shellwords.shellwords(binary)| ... } ⇒ Object
353 354 355 |
# File 'lib/arpie/protocol.rb', line 353 def from binary yield Shellwords.shellwords(binary) end |
#to(object) ⇒ Object
347 348 349 350 351 |
# File 'lib/arpie/protocol.rb', line 347 def to object raise ArgumentError, "#{self.class.to_s} can only encode arrays." unless object.is_a?(Array) Shellwords.join(object.map {|x| x.to_s }) end |