replace Fixnum and Bignum with Integer

This commit is contained in:
Charlie Somerville 2017-01-11 15:00:27 +11:00
Родитель 2c645f789f
Коммит d8de16106a
2 изменённых файлов: 5 добавлений и 5 удалений

Просмотреть файл

@ -10,7 +10,7 @@ See the BERT specification at [bert-rpc.org](http://bert-rpc.org).
Instances of the following Ruby classes will be automatically converted to the
proper simple BERT type:
* Fixnum
* Integer
* Float
* Symbol
* Array
@ -47,12 +47,12 @@ Usage
-----
require 'bert'
bert = BERT.encode(t[:user, {:name => 'TPW', :nick => 'mojombo'}])
# => "\203h\002d\000\004userh\003d\000\004bertd\000\004dictl\000\000\
000\002h\002d\000\004namem\000\000\000\003TPWh\002d\000\004nickm\
000\000\000\amojomboj"
BERT.decode(bert)
# => t[:user, {:name=>"TPW", :nick=>"mojombo"}]

Просмотреть файл

@ -98,7 +98,7 @@ module BERT
case obj
when Symbol then write_symbol(obj)
when String then write_binary(obj)
when Fixnum, Bignum then write_fixnum(obj)
when Integer then write_integer(obj)
when Float then write_float(obj)
when Tuple then write_tuple(obj)
when Array then write_list(obj)
@ -135,7 +135,7 @@ module BERT
write_string data
end
def write_fixnum(num)
def write_integer(num)
if num >= 0 && num < 256
write_1 SMALL_INT
write_1 num