protobuf_java_helpers 0.1.0-java → 0.1.1-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: de411bfffc972a22f24c695a0ba52f6c344dfdd4
4
- data.tar.gz: a32e631dbd10a87e8d401daa85ad99d124c3bfcb
3
+ metadata.gz: a3f9b31577a8febb01cea661b249658bd7687ae2
4
+ data.tar.gz: 900ded1d519d468307eb34efc4bb313731fec93b
5
5
  SHA512:
6
- metadata.gz: f3c2f52ba0a206436059dceb2c5b63640496bfb1ae7cf8b426641930cba6776deef406b9c9cf627587ce5295a3d30654cf671778c3dbf4261a9f462dccface8f
7
- data.tar.gz: f66bc71159bab7b9d3b9646bcb7ecfb9275456868af541fcaa0f39b8dec66eeab3f64fe9923de040b852228826fe28356f828a055096d248f96565dcd668ae89
6
+ metadata.gz: 99ab497203ad7e98a8cc4a3fe63dbcc7098e8f4dc749a777748d8a476d073724a4062c41b8df4932da68aba0f87460292e0a8bd0456ce3c519d8413a630343fb
7
+ data.tar.gz: 56ba95bebf58a01272beaf2665d8ad3fd1466d52aa83d459f41e534ad383f622d0a8870188e11000b6b88ab96637b54e2ebf85fe3563f0af94d9af27d87ac109
data/.gitignore CHANGED
@@ -7,3 +7,5 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ Gemfile.lock
11
+
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- protobuf_java_helpers (0.1.0-java)
4
+ protobuf_java_helpers (0.1.1-java)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -39,11 +39,11 @@ public class Varinter {
39
39
  }
40
40
 
41
41
  @JRubyMethod(name = "acceptable?")
42
- public static IRubyObject acceptable_p( ThreadContext context, IRubyObject self ) {
42
+ public static IRubyObject acceptable_p( ThreadContext context, IRubyObject self, IRubyObject recv ) {
43
43
  org.jruby.Ruby runtime = context.getRuntime();
44
44
 
45
- if (self instanceof RubyInteger || self instanceof RubyFixnum) {
46
- long value = ((RubyFixnum) self).getLongValue();
45
+ if (recv instanceof RubyInteger || recv instanceof RubyFixnum) {
46
+ long value = ((RubyFixnum) recv).getLongValue();
47
47
 
48
48
  if (value >= 0 && value <= INT32_MAX) {
49
49
  return runtime.getTrue();
@@ -56,12 +56,12 @@ public class Varinter {
56
56
  }
57
57
 
58
58
  @JRubyMethod
59
- public static IRubyObject to_varint( ThreadContext context, IRubyObject self ) {
60
- if (!(self instanceof RubyInteger || self instanceof RubyFixnum)) {
59
+ public static IRubyObject to_varint( ThreadContext context, IRubyObject self, IRubyObject recv ) {
60
+ if (!(recv instanceof RubyInteger || recv instanceof RubyFixnum)) {
61
61
  return context.nil;
62
62
  }
63
63
 
64
- long value = ((RubyFixnum) self).getLongValue();
64
+ long value = ((RubyFixnum) recv).getLongValue();
65
65
  org.jruby.Ruby runtime = context.getRuntime();
66
66
  RubyString bit_string = runtime.newString(new ByteList(internal_to_varint(value), true));
67
67
  bit_string.force_encoding(context, runtime.getEncodingService().getEncoding(org.jcodings.specific.ASCIIEncoding.INSTANCE));
@@ -69,12 +69,12 @@ public class Varinter {
69
69
  }
70
70
 
71
71
  @JRubyMethod
72
- public static IRubyObject to_varint_64( ThreadContext context, IRubyObject self ) {
73
- if (!(self instanceof RubyInteger || self instanceof RubyFixnum)) {
72
+ public static IRubyObject to_varint_64( ThreadContext context, IRubyObject self, IRubyObject recv ) {
73
+ if (!(recv instanceof RubyInteger || recv instanceof RubyFixnum)) {
74
74
  return context.nil;
75
75
  }
76
76
 
77
- long value = ((RubyFixnum) self).getLongValue();
77
+ long value = ((RubyFixnum) recv).getLongValue();
78
78
  org.jruby.Ruby runtime = context.getRuntime();
79
79
  RubyString bit_string = runtime.newString(new ByteList(internal_to_varint(value & 0xffffffffffffffffL), true));
80
80
  bit_string.force_encoding(context, runtime.getEncodingService().getEncoding(org.jcodings.specific.ASCIIEncoding.INSTANCE));
@@ -82,17 +82,17 @@ public class Varinter {
82
82
  }
83
83
 
84
84
  @JRubyMethod
85
- public static IRubyObject read_varint(ThreadContext context, IRubyObject self) throws IOException {
85
+ public static IRubyObject read_varint(ThreadContext context, IRubyObject self, IRubyObject recv ) throws IOException {
86
86
  long value = 0L;
87
87
  int index = 0;
88
88
  long current_byte;
89
89
 
90
- if (self instanceof StringIO) {
91
- StringIO current_self = ((StringIO)self);
90
+ if (recv instanceof StringIO) {
91
+ StringIO current_recv = ((StringIO)recv);
92
92
  RubyFixnum fixnum;
93
93
 
94
94
  do {
95
- fixnum = ((RubyFixnum)(current_self.getbyte(context)));
95
+ fixnum = ((RubyFixnum)(current_recv.getbyte(context)));
96
96
  current_byte = fixnum.getLongValue();
97
97
  if (index == 0 && current_byte < 128) { return context.getRuntime().newFixnum(current_byte); }
98
98
  value = (value | ((current_byte & 0x7f) << (7 * index)));
@@ -102,11 +102,11 @@ public class Varinter {
102
102
  return context.getRuntime().newFixnum(value);
103
103
  }
104
104
 
105
- if (self instanceof RubyIO) {
106
- RubyIO current_self = ((RubyIO)self);
105
+ if (recv instanceof RubyIO) {
106
+ RubyIO current_recv = ((RubyIO)recv);
107
107
 
108
108
  do {
109
- current_byte = current_self.getByte(context);
109
+ current_byte = current_recv.getByte(context);
110
110
  if (index == 0 && current_byte < 128) { return context.getRuntime().newFixnum(current_byte); }
111
111
  value = (value | ((current_byte & 0x7f) << (7 * index)));
112
112
  index++;
Binary file
@@ -1,3 +1,3 @@
1
1
  module ProtobufJavaHelpers
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protobuf_java_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: java
6
6
  authors:
7
7
  - Brandon Dewitt