Class: Simrpc::Message::Body
- Inherits:
-
Object
- Object
- Simrpc::Message::Body
- Defined in:
- lib/simrpc/message.rb
Overview
body consists of a list of data fields
Instance Attribute Summary collapse
-
#fields ⇒ Object
Returns the value of attribute fields.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Body
constructor
A new instance of Body.
- #to_s ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Body
129 130 131 |
# File 'lib/simrpc/message.rb', line 129 def initialize(args = {}) @fields = [] end |
Instance Attribute Details
#fields ⇒ Object
Returns the value of attribute fields.
127 128 129 |
# File 'lib/simrpc/message.rb', line 127 def fields @fields end |
Class Method Details
.from_s(data) ⇒ Object
142 143 144 145 146 147 148 149 150 |
# File 'lib/simrpc/message.rb', line 142 def self.from_s(data) body = Body.new while(data != "") field, data = Formatter::parse_from_formatted(data) field = Field.from_s field body.fields.push field end return body end |
Instance Method Details
#to_s ⇒ Object
133 134 135 136 137 138 139 140 |
# File 'lib/simrpc/message.rb', line 133 def to_s s = '' @fields.each { |field| fs = field.to_s s += Formatter::format_with_size(fs) } return s end |