Class: Nailgun::Client::Chunk

Inherits:
Object
  • Object
show all
Defined in:
lib/nailgun/client/chunk.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#contentObject (readonly)

Returns the value of attribute content.



4
5
6
# File 'lib/nailgun/client/chunk.rb', line 4

def content
  @content
end

#typeObject (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

#headerObject



11
12
13
# File 'lib/nailgun/client/chunk.rb', line 11

def header
  ChunkHeader.new(type, length)
end

#lengthObject



15
16
17
# File 'lib/nailgun/client/chunk.rb', line 15

def length
  content.length
end

#to_sObject



19
20
21
# File 'lib/nailgun/client/chunk.rb', line 19

def to_s
  header.to_s + content
end