зеркало из https://github.com/github/bert.git
Merge pull request #6 from github/write-1-speed
speed up `write_1` calls
This commit is contained in:
Коммит
c489ecd510
|
@ -97,18 +97,18 @@ module BERT
|
||||||
def write_any_raw obj
|
def write_any_raw obj
|
||||||
case obj
|
case obj
|
||||||
when Symbol then write_symbol(obj)
|
when Symbol then write_symbol(obj)
|
||||||
|
when String then write_binary(obj)
|
||||||
when Fixnum, Bignum then write_fixnum(obj)
|
when Fixnum, Bignum then write_fixnum(obj)
|
||||||
when Float then write_float(obj)
|
when Float then write_float(obj)
|
||||||
when Tuple then write_tuple(obj)
|
when Tuple then write_tuple(obj)
|
||||||
when Array then write_list(obj)
|
when Array then write_list(obj)
|
||||||
when String then write_binary(obj)
|
|
||||||
else
|
else
|
||||||
fail(obj)
|
fail(obj)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def write_1(byte)
|
def write_1(byte)
|
||||||
out.write([byte].pack("C"))
|
out.write(byte.chr)
|
||||||
end
|
end
|
||||||
|
|
||||||
def write_2(short)
|
def write_2(short)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче