Class: Nailgun::Client::Chunk
- Inherits:
-
Object
- Object
- Nailgun::Client::Chunk
- Defined in:
- lib/nailgun/client/chunk.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #header ⇒ Object
-
#initialize(type, content) ⇒ Chunk
constructor
A new instance of Chunk.
- #length ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(type, content) ⇒ Chunk
Returns a new instance of Chunk.
6 7 8 9 |
# File 'lib/nailgun/client/chunk.rb', line 6 def initialize(type, content) @content = content.to_s @type = type end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
4 5 6 |
# File 'lib/nailgun/client/chunk.rb', line 4 def content @content end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/nailgun/client/chunk.rb', line 4 def type @type end |
Instance Method Details
#header ⇒ Object
11 12 13 |
# File 'lib/nailgun/client/chunk.rb', line 11 def header ChunkHeader.new(type, length) end |
#length ⇒ Object
15 16 17 |
# File 'lib/nailgun/client/chunk.rb', line 15 def length content.length end |
#to_s ⇒ Object
19 20 21 |
# File 'lib/nailgun/client/chunk.rb', line 19 def to_s header.to_s + content end |