naming 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/naming.rb CHANGED
@@ -130,6 +130,18 @@ module Naming
130
130
  def value
131
131
  @value
132
132
  end
133
+
134
+ # @api private
135
+ def ==(other)
136
+ return false unless other.kind_of?(self.class)
137
+ @value == other.value
138
+ end
139
+ alias :eql? :"=="
140
+
141
+ # @api private
142
+ def hash
143
+ @value.hash
144
+ end
133
145
  end
134
146
 
135
147
  class << self
@@ -1,4 +1,4 @@
1
1
  module Naming
2
2
  # version of this library
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
data/test/spec_naming.rb CHANGED
@@ -29,4 +29,16 @@ describe 'Naming' do
29
29
  Naming::B.values(list).should == [2]
30
30
  Naming.others(list).should == ["abc", 123, nil]
31
31
  end
32
+
33
+ it 'should equal when the names and values are same' do
34
+ Naming.A(1).should == Naming.A(1)
35
+ end
36
+
37
+ it 'should equal when names are different' do
38
+ Naming.A(1).should.not == Naming.B(1)
39
+ end
40
+
41
+ it 'should equal when values are different' do
42
+ Naming.A(1).should.not == Naming.A(2)
43
+ end
32
44
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: naming
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: