symboltable 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -60,7 +60,7 @@ From a local copy:
60
60
 
61
61
  == License
62
62
 
63
- Copyright 2010 Michael J. I. Jackson
63
+ Copyright 2010 Michael Jackson
64
64
 
65
65
  Permission is hereby granted, free of charge, to any person obtaining a copy
66
66
  of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,4 @@
1
- # A Hash that forces all keys to be symbols.
2
- #
3
- # See http://github.com/mjijackson/symboltable for more information.
1
+ # A Symbols-only Hash for Ruby.
4
2
  class SymbolTable < Hash
5
3
 
6
4
  def initialize(hash=nil)
@@ -14,7 +12,7 @@ class SymbolTable < Hash
14
12
  end
15
13
 
16
14
  def key?(key)
17
- super(key) || (valid_key?(key) && super(key.to_sym))
15
+ valid_key?(key) && super(key.to_sym)
18
16
  end
19
17
 
20
18
  def [](key)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'symboltable'
3
- s.version = '0.1'
3
+ s.version = '0.2'
4
4
  s.date = '2010-04-08'
5
5
 
6
6
  s.summary = 'A Symbols-only Hash for Ruby'
@@ -1,5 +1,5 @@
1
- libdir = File.dirname(File.dirname(__FILE__)) + '/lib'
2
- $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
1
+ lib = File.dirname(File.dirname(__FILE__)) + '/lib'
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
4
  require 'test/unit'
5
5
  require 'symboltable'
@@ -23,9 +23,6 @@ class SymbolTableTest < Test::Unit::TestCase
23
23
  t['b'] = 1
24
24
  assert_equal(1, t[:b])
25
25
  assert_equal(1, t['b'])
26
-
27
- assert_equal([:a, :b], t.keys)
28
- assert_equal([1, 1], t.values)
29
26
  end
30
27
 
31
28
  def test_store
@@ -38,9 +35,6 @@ class SymbolTableTest < Test::Unit::TestCase
38
35
  t.store('b', 1)
39
36
  assert_equal(1, t[:b])
40
37
  assert_equal(1, t['b'])
41
-
42
- assert_equal([:a, :b], t.keys)
43
- assert_equal([1, 1], t.values)
44
38
  end
45
39
 
46
40
  def test_update
@@ -53,9 +47,6 @@ class SymbolTableTest < Test::Unit::TestCase
53
47
  t.update('b' => 1)
54
48
  assert_equal(1, t[:b])
55
49
  assert_equal(1, t['b'])
56
-
57
- assert_equal([:a, :b], t.keys)
58
- assert_equal([1, 1], t.values)
59
50
  end
60
51
 
61
52
  def test_merge!
@@ -68,9 +59,6 @@ class SymbolTableTest < Test::Unit::TestCase
68
59
  t.merge!('b' => 1)
69
60
  assert_equal(1, t[:b])
70
61
  assert_equal(1, t['b'])
71
-
72
- assert_equal([:a, :b], t.keys)
73
- assert_equal([1, 1], t.values)
74
62
  end
75
63
 
76
64
  def test_method_missing
@@ -80,9 +68,6 @@ class SymbolTableTest < Test::Unit::TestCase
80
68
  assert_equal(1, t[:a])
81
69
  assert_equal(1, t['a'])
82
70
  assert_equal(1, t.a)
83
-
84
- assert_equal([:a], t.keys)
85
- assert_equal([1], t.values)
86
71
  end
87
72
 
88
73
  def test_nested_tables
metadata CHANGED
@@ -4,8 +4,8 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
8
- version: "0.1"
7
+ - 2
8
+ version: "0.2"
9
9
  platform: ruby
10
10
  authors:
11
11
  - Michael J. I. Jackson