shash 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/lib/shash.rb +5 -1
  2. data/lib/version.rb +1 -1
  3. data/test/test_shash.rb +14 -1
  4. metadata +1 -1
data/lib/shash.rb CHANGED
@@ -27,9 +27,13 @@ class Shash
27
27
  end
28
28
  alias_method :key?, :has_key?
29
29
 
30
- def == other
30
+ def ==(other)
31
31
  @hash == other.hash
32
32
  end
33
+
34
+ def []=(key,value)
35
+ @hash[key] = value
36
+ end
33
37
  end
34
38
 
35
39
  class Hash
data/lib/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  class Shash
2
2
  MAJOR = 0
3
3
  MINOR = 0
4
- BUILD = 2
4
+ BUILD = 3
5
5
 
6
6
  VERSION = "#{MAJOR}.#{MINOR}.#{BUILD}"
7
7
  end
data/test/test_shash.rb CHANGED
@@ -24,10 +24,23 @@ describe Shash do
24
24
  h.should == {"y"=>{"z"=>0}}.to_shash
25
25
  end
26
26
 
27
- it "#respond_to? should check for key existence correctly" do
27
+ it "#has_key? should check for key existence correctly" do
28
28
  h = {"a"=>1, "b"=>{"c"=>2}}.to_shash
29
29
  h.has_key?("z").should == false
30
30
  h.has_key?("b").should == true
31
31
  h.b.has_key?("c").should == true
32
32
  end
33
+
34
+ it "#[] should still works as expected" do
35
+ h = {"a"=>1}.to_shash
36
+ h.a.should == 1
37
+ h["a"].should == 1
38
+ end
39
+
40
+ it "#[]= should still works as expected" do
41
+ h = Shash.new
42
+ h["b"] = 2
43
+ h.b.should == 2
44
+ end
45
+
33
46
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: