Skip to content

Commit

Permalink
Merge pull request #5 from Papierkorb/master
Browse files Browse the repository at this point in the history
use IO::Memory instead of MemoryIO to fix warning
  • Loading branch information
jeromegn committed Feb 6, 2017
2 parents 79ce6a9 + b870361 commit b9c556c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -61,9 +61,9 @@ proto_io = File.read("path/to/encoded/protobuf") # get your IO in some way
msg = MyMessage.from_protobuf(proto_io) # returns a an instance of MyMessage
# from a valid protobuf encoded message
msg.to_protobuf # return a MemoryIO filled with the encoded message
msg.to_protobuf # return a IO::Memory filled with the encoded message
some_io = MemoryIO.new
some_io = IO::Memory.new
msg.to_protobuf(some_io) # fills up the provided IO with the encoded message
```

Expand Down
2 changes: 1 addition & 1 deletion src/enum.cr
Expand Up @@ -13,7 +13,7 @@ abstract struct Enum
end

def to_protobuf(embedded = true)
io = MemoryIO.new
io = IO::Memory.new
to_protobuf(io, embedded)
end
end
4 changes: 2 additions & 2 deletions src/protobuf/buffer.cr
Expand Up @@ -108,7 +108,7 @@ module Protobuf
def new_from_length
slice = read_bytes
return nil if slice.nil?
Protobuf::Buffer.new MemoryIO.new(slice)
Protobuf::Buffer.new IO::Memory.new(slice)
end

def decode_zigzag(value)
Expand Down Expand Up @@ -208,7 +208,7 @@ module Protobuf
end

def write_packed(arr, pb_type)
io = MemoryIO.new
io = IO::Memory.new
tmp_buf = self.class.new(io)
arr.not_nil!.each {|i| tmp_buf.write(i, pb_type) }
write_uint64(io.bytesize.to_u64)
Expand Down
2 changes: 1 addition & 1 deletion src/protobuf/message.cr
Expand Up @@ -138,7 +138,7 @@ module Protobuf

macro _generate_encoder
def to_protobuf
io = MemoryIO.new
io = IO::Memory.new
to_protobuf(io)
io
end
Expand Down

0 comments on commit b9c556c

Please sign in to comment.