beefcake 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -95,22 +95,24 @@ Source:
95
95
 
96
96
  $ git clone git://github.com/bmizerany/beefcake
97
97
 
98
- Testing:
98
+ ## Testing:
99
99
 
100
100
  $ gem install turn
101
101
  $ cd /path/to/beefcake
102
102
  $ turn
103
103
 
104
- VMs:
104
+ ## VMs:
105
105
 
106
106
  Currently Beefcake is tested and working on:
107
107
 
108
- Ruby 1.8.7
109
- Ruby 1.9.2
110
- JRuby 1.5.6
108
+ * Ruby 1.8.7
109
+ * Ruby 1.9.2
110
+ * JRuby 1.5.6
111
111
 
112
- There is a bug in Rubinius preventing proper ZigZag encoding.
113
- The team is aware and I'm sure they're working on a fix.
112
+ There is a bug in Rubinius preventing proper ZigZag encoding.
113
+ The team is aware and I'm sure they're working on a fix.
114
+
115
+ ## Future
114
116
 
115
117
  Nice to have:
116
118
 
@@ -14,7 +14,7 @@ module Beefcake
14
14
 
15
15
  def self.wire_for(type)
16
16
  case type
17
- when :int32, :uint32, :sint32, :int64, :uint64, :sint64, :bool
17
+ when :int32, :uint32, :sint32, :int64, :uint64, :sint64, :bool, Module
18
18
  0
19
19
  when :fixed64, :sfixed64, :double
20
20
  1
@@ -82,6 +82,8 @@ module Beefcake
82
82
  case n
83
83
  when Symbol
84
84
  __send__("read_#{n}")
85
+ when Module
86
+ read_uint64
85
87
  else
86
88
  buf.slice!(0, n)
87
89
  end
@@ -18,7 +18,7 @@ module Beefcake
18
18
  end
19
19
 
20
20
  def append_fixed32(n, tag=false)
21
- if n < MinUint32 or n > MaxUint32
21
+ if n < MinUint32 || n > MaxUint32
22
22
  raise OutOfRangeError, n
23
23
  end
24
24
 
@@ -26,7 +26,7 @@ module Beefcake
26
26
  end
27
27
 
28
28
  def append_fixed64(n)
29
- if n < MinUint64 or n > MaxUint64
29
+ if n < MinUint64 || n > MaxUint64
30
30
  raise OutOfRangeError, n
31
31
  end
32
32
 
@@ -34,7 +34,7 @@ module Beefcake
34
34
  end
35
35
 
36
36
  def append_int32(n)
37
- if n < MinInt32 or n > MaxInt32
37
+ if n < MinInt32 || n > MaxInt32
38
38
  raise OutOfRangeError, n
39
39
  end
40
40
 
@@ -42,7 +42,7 @@ module Beefcake
42
42
  end
43
43
 
44
44
  def append_uint32(n)
45
- if n < MinUint32 or n > MaxUint32
45
+ if n < MinUint32 || n > MaxUint32
46
46
  raise OutOfRangeError, n
47
47
  end
48
48
 
@@ -50,7 +50,7 @@ module Beefcake
50
50
  end
51
51
 
52
52
  def append_int64(n)
53
- if n < MinInt64 or n > MaxInt64
53
+ if n < MinInt64 || n > MaxInt64
54
54
  raise OutOfRangeError, n
55
55
  end
56
56
 
@@ -78,7 +78,7 @@ module Beefcake
78
78
  end
79
79
 
80
80
  def append_uint64(n)
81
- if n < MinUint64 or n > MaxUint64
81
+ if n < MinUint64 || n > MaxUint64
82
82
  raise OutOfRangeError, n
83
83
  end
84
84
 
data/test/message_test.rb CHANGED
@@ -277,4 +277,10 @@ class MessageTest < Test::Unit::TestCase
277
277
  end
278
278
  end
279
279
 
280
+ def test_decode_enum
281
+ msg = EnumsMessage.new(:a => 1).encode
282
+ got = EnumsMessage.decode(msg)
283
+ assert_equal 1, got.a
284
+ end
285
+
280
286
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Blake Mizerany