xdr 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/xdr/struct.rb +9 -1
- data/lib/xdr/union.rb +10 -0
- data/lib/xdr/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 567cdbd85c15a73c60ecfc68de35a015bf6cfb2d
|
4
|
+
data.tar.gz: c2f57208097a04173a8785c6a77cb5a489afedf0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 646b2bb208e5b3edfc1ffa47425d4bde171e3745c9ce2a931da47861f41abc110862477baf62c205086f495eee61f27ec9a6053651aa7afc17152cfd6be742e0
|
7
|
+
data.tar.gz: 46e9164a46f9a91d50b770986618c5ebf0796e5611b773a78c8706d24b9012aab09fe6e117bd583cb185484016d4d4a0186d57a2d57c7644745ebca13ec762a9
|
data/lib/xdr/struct.rb
CHANGED
@@ -9,7 +9,7 @@ class XDR::Struct
|
|
9
9
|
|
10
10
|
attribute_method_prefix 'read_'
|
11
11
|
attribute_method_suffix 'write_'
|
12
|
-
|
12
|
+
|
13
13
|
class_attribute :fields
|
14
14
|
self.fields = ActiveSupport::OrderedHash.new
|
15
15
|
|
@@ -68,6 +68,14 @@ class XDR::Struct
|
|
68
68
|
other.attributes == self.attributes
|
69
69
|
end
|
70
70
|
|
71
|
+
def eql? (other)
|
72
|
+
return false unless other.is_a?(self.class)
|
73
|
+
other.attributes.eql? self.attributes
|
74
|
+
end
|
75
|
+
|
76
|
+
def hash
|
77
|
+
[self.class, self.attribues].hash
|
78
|
+
end
|
71
79
|
|
72
80
|
def read_attribute(attr)
|
73
81
|
@attributes[attr]
|
data/lib/xdr/union.rb
CHANGED
@@ -114,6 +114,16 @@ class XDR::Union
|
|
114
114
|
other.value == self.value
|
115
115
|
end
|
116
116
|
|
117
|
+
def eql?(other)
|
118
|
+
return false unless other.is_a?(self.class)
|
119
|
+
return false unless other.switch.eql? self.switch
|
120
|
+
other.value.eql? self.value
|
121
|
+
end
|
122
|
+
|
123
|
+
def hash
|
124
|
+
[self.class, self.switch, self.value].hash
|
125
|
+
end
|
126
|
+
|
117
127
|
private
|
118
128
|
def valid_for_arm_type(value, arm)
|
119
129
|
arm_type = arms[@arm]
|
data/lib/xdr/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xdr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Fleckenstein
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|