shash 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/lib/shash.rb +9 -5
  2. data/lib/version.rb +1 -1
  3. metadata +41 -19
data/lib/shash.rb CHANGED
@@ -5,14 +5,14 @@ class Shash
5
5
  end
6
6
 
7
7
  def _key key
8
- @_proc ? @_proc.call(key) : key
8
+ @_proc ? @_proc.call(key) : key.to_s
9
9
  end
10
10
 
11
11
  def method_missing(key, *args, &block)
12
12
  if key[/=$/]
13
13
  @_hash[_key(key[0...-1])] = args.first
14
14
  else
15
- if value = @_hash[_key(key.to_s)]
15
+ if value = @_hash[_key(key)]
16
16
  case value
17
17
  when Hash
18
18
  Shash.new(value, &@_proc)
@@ -20,7 +20,11 @@ class Shash
20
20
  value
21
21
  end
22
22
  else
23
- @_hash.send(key, *args, &block)
23
+ begin
24
+ @_hash.send(key, *args, &block)
25
+ rescue NoMethodError
26
+ nil
27
+ end
24
28
  end
25
29
  end
26
30
  end
@@ -40,7 +44,7 @@ class Shash
40
44
  end
41
45
 
42
46
  class Hash
43
- def to_shash
44
- Shash.new(self)
47
+ def to_shash &proc
48
+ Shash.new(self, &proc)
45
49
  end
46
50
  end
data/lib/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  class Shash
2
2
  MAJOR = 0
3
3
  MINOR = 0
4
- BUILD = 5
4
+ BUILD = 6
5
5
 
6
6
  VERSION = "#{MAJOR}.#{MINOR}.#{BUILD}"
7
7
  end
metadata CHANGED
@@ -1,52 +1,74 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: shash
3
- version: !ruby/object:Gem::Version
4
- version: 0.0.5
3
+ version: !ruby/object:Gem::Version
4
+ hash: 19
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 6
10
+ version: 0.0.6
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Christian Blais
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2011-09-01 00:00:00.000000000Z
17
+
18
+ date: 2011-11-07 00:00:00 -05:00
19
+ default_executable:
13
20
  dependencies: []
21
+
14
22
  description: Replace hash keys with method calls
15
- email:
23
+ email:
16
24
  - christ.blais@gmail.com
17
25
  executables: []
26
+
18
27
  extensions: []
28
+
19
29
  extra_rdoc_files: []
20
- files:
30
+
31
+ files:
21
32
  - LICENSE
22
33
  - README.md
23
34
  - lib/shash.rb
24
35
  - lib/version.rb
25
36
  - shash.gemspec
26
37
  - test/test_shash.rb
38
+ has_rdoc: true
27
39
  homepage: http://github.com/christianblais/shash
28
40
  licenses: []
41
+
29
42
  post_install_message:
30
43
  rdoc_options: []
31
- require_paths:
44
+
45
+ require_paths:
32
46
  - lib
33
47
  - test
34
- required_ruby_version: !ruby/object:Gem::Requirement
48
+ required_ruby_version: !ruby/object:Gem::Requirement
35
49
  none: false
36
- requirements:
37
- - - ! '>='
38
- - !ruby/object:Gem::Version
39
- version: '0'
40
- required_rubygems_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ hash: 3
54
+ segments:
55
+ - 0
56
+ version: "0"
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
41
58
  none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ hash: 3
63
+ segments:
64
+ - 0
65
+ version: "0"
46
66
  requirements: []
67
+
47
68
  rubyforge_project:
48
- rubygems_version: 1.8.8
69
+ rubygems_version: 1.6.2
49
70
  signing_key:
50
71
  specification_version: 3
51
72
  summary: Replace hash keys with method calls
52
73
  test_files: []
74
+