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
Constants included from Arpie
Instance Attribute Summary
Attributes inherited from Protocol
Instance Method Summary collapse
- #from(binary) {|Shellwords.shellwords(binary)| ... } ⇒ Object
- #to(object) {|Shellwords.join(object.map {|x| x.to_s })| ... } ⇒ Object
Methods inherited from Protocol
#again!, #assemble, #assemble!
Methods included from Arpie
Instance Method Details
#from(binary) {|Shellwords.shellwords(binary)| ... } ⇒ Object
333 334 335 |
# File 'lib/arpie/protocol.rb', line 333 def from binary yield Shellwords.shellwords(binary) end |
#to(object) {|Shellwords.join(object.map {|x| x.to_s })| ... } ⇒ Object
327 328 329 330 331 |
# File 'lib/arpie/protocol.rb', line 327 def to object raise ArgumentError, "#{self.class.to_s} can only encode arrays." unless object.is_a?(Array) yield Shellwords.join(object.map {|x| x.to_s }) end |