Skip to content

Commit

Permalink
MessagePackPure::Unpacker.readメソッドを削除
Browse files Browse the repository at this point in the history
  • Loading branch information
nayutaya committed Mar 8, 2010
1 parent 15223a0 commit 8eb3c9d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
3 changes: 2 additions & 1 deletion lib/msgpack_pure/core.rb
Expand Up @@ -14,6 +14,7 @@ def self.pack(value)


def self.unpack(binary) def self.unpack(binary)
io = StringIO.new(binary, "r") io = StringIO.new(binary, "r")
return Unpacker.read(io) unpacker = Unpacker.new(io)
return unpacker.read
end end
end end
5 changes: 0 additions & 5 deletions lib/msgpack_pure/unpacker.rb
Expand Up @@ -15,11 +15,6 @@ def initialize(io)


attr_reader :io attr_reader :io


def self.read(io)
unpacker = self.new(io)
return unpacker.read
end

def read def read
type = self.unpack_uint8 type = self.unpack_uint8


Expand Down
13 changes: 6 additions & 7 deletions test/unpacker_test.rb
Expand Up @@ -8,7 +8,6 @@
class UnpackerTest < Test::Unit::TestCase class UnpackerTest < Test::Unit::TestCase
def setup def setup
@klass = MessagePackPure::Unpacker @klass = MessagePackPure::Unpacker
@module = MessagePackPure::Unpacker
end end


def test_initialize def test_initialize
Expand Down Expand Up @@ -134,7 +133,7 @@ def test_read__fixarray
i i
} }
io.rewind io.rewind
assert_equal(array, @module.read(io)) assert_equal(array, @klass.new(io).read)
end end


def test_read__array16 def test_read__array16
Expand All @@ -147,7 +146,7 @@ def test_read__array16
i i
} }
io.rewind io.rewind
assert_equal(array, @module.read(io)) assert_equal(array, @klass.new(io).read)
end end


def test_read__array32 def test_read__array32
Expand All @@ -160,7 +159,7 @@ def test_read__array32
i i
} }
io.rewind io.rewind
assert_equal(array, @module.read(io)) assert_equal(array, @klass.new(io).read)
end end


def test_read__fixmap def test_read__fixmap
Expand All @@ -177,7 +176,7 @@ def test_read__fixmap
memo memo
} }
io.rewind io.rewind
assert_equal(hash, @module.read(io)) assert_equal(hash, @klass.new(io).read)
end end


def test_read__map16 def test_read__map16
Expand All @@ -194,7 +193,7 @@ def test_read__map16
memo memo
} }
io.rewind io.rewind
assert_equal(hash, @module.read(io)) assert_equal(hash, @klass.new(io).read)
end end


def test_read__map32 def test_read__map32
Expand All @@ -211,7 +210,7 @@ def test_read__map32
memo memo
} }
io.rewind io.rewind
assert_equal(hash, @module.read(io)) assert_equal(hash, @klass.new(io).read)
end end


private private
Expand Down

0 comments on commit 8eb3c9d

Please sign in to comment.