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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bc2054a14c8b40897a81b9758fe8f7d48fa5be07
4
- data.tar.gz: 3bddeb7f3628cb88feae1800467e060080b8b942
3
+ metadata.gz: 567cdbd85c15a73c60ecfc68de35a015bf6cfb2d
4
+ data.tar.gz: c2f57208097a04173a8785c6a77cb5a489afedf0
5
5
  SHA512:
6
- metadata.gz: b22b70f5094869e0f09d9819b63746eab3416416eb4a7c2128043888e587dc4e7a5e7a7452e9df925d302d9f771883ca72b76615c9588059c15d9fec793ff59d
7
- data.tar.gz: 6d8bdbafec1e37e2a6a9ade6d139ebd94cf297277e9ff25b676560d6f1d85f70fd8e7e71123d01170e5fcc09a285253a9ce56c303b1fb4f2d84f08e52082c329
6
+ metadata.gz: 646b2bb208e5b3edfc1ffa47425d4bde171e3745c9ce2a931da47861f41abc110862477baf62c205086f495eee61f27ec9a6053651aa7afc17152cfd6be742e0
7
+ data.tar.gz: 46e9164a46f9a91d50b770986618c5ebf0796e5611b773a78c8706d24b9012aab09fe6e117bd583cb185484016d4d4a0186d57a2d57c7644745ebca13ec762a9
@@ -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]
@@ -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]
@@ -1,3 +1,3 @@
1
1
  module XDR
2
- VERSION = "0.0.4"
2
+ VERSION = "0.1.0"
3
3
  end
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
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-09 00:00:00.000000000 Z
11
+ date: 2015-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport