Class: Bones::RPC::Adapter::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/bones/rpc/adapter/parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(adapter, data) ⇒ Parser

Returns a new instance of Parser.



9
10
11
12
# File 'lib/bones/rpc/adapter/parser.rb', line 9

def initialize(adapter, data)
  @adapter = Adapter.get(adapter)
  @data = data
end

Instance Attribute Details

#adaperObject (readonly)

Returns the value of attribute adaper.



7
8
9
# File 'lib/bones/rpc/adapter/parser.rb', line 7

def adaper
  @adaper
end

#dataObject (readonly)

Returns the value of attribute data.



7
8
9
# File 'lib/bones/rpc/adapter/parser.rb', line 7

def data
  @data
end

Instance Method Details

#packerObject



14
15
16
# File 'lib/bones/rpc/adapter/parser.rb', line 14

def packer
  @packer ||= @adapter.packer(data)
end

#readObject



18
19
20
# File 'lib/bones/rpc/adapter/parser.rb', line 18

def read
  unpacker.read
end

#unpackerObject



26
27
28
# File 'lib/bones/rpc/adapter/parser.rb', line 26

def unpacker
  @unpacker ||= @adapter.unpacker(data)
end

#unpacker_posObject



30
31
32
# File 'lib/bones/rpc/adapter/parser.rb', line 30

def unpacker_pos
  @adapter.unpacker_pos(self)
end

#unpacker_seek(n) ⇒ Object



22
23
24
# File 'lib/bones/rpc/adapter/parser.rb', line 22

def unpacker_seek(n)
  @adapter.unpacker_seek(self, n)
end