xkeys 2.0.1 → 2.1.0

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 (4) hide show
  1. data/HISTORY.txt +4 -0
  2. data/lib/xkeys.rb +5 -2
  3. data/xkeys.gemspec +2 -2
  4. metadata +3 -3
@@ -1,3 +1,7 @@
1
+ 2014-05-06 Version 2.1.0
2
+
3
+ Now works with underlying types that support #[] but not #fetch.
4
+
1
5
  2014-04-16 Version 2.0.1
2
6
 
3
7
  Added documentation to the module overview specifying the
@@ -27,7 +27,10 @@
27
27
  # #fetch to be supported (see the Array or Hash class documentation).
28
28
  # They must also implement #push if you want to use push mode (index ":[]").
29
29
  #
30
- # Version 2.0.1 2014-04-16
30
+ # As of version 2.1.0, #[] is used if #fetch is not supported. Missing-key
31
+ # detection (still) depends on KeyError or IndexError being raised.
32
+ #
33
+ # Version 2.1.0 2014-05-06
31
34
  #
32
35
  # @author Brian Katzung <briank@kappacs.com>, Kappa Computer Solutions, LLC
33
36
  # @copyright 2013-2014 Brian Katzung and Kappa Computer Solutions, LLC
@@ -64,7 +67,7 @@ module XKeys::Get
64
67
  end
65
68
 
66
69
  args[0..last].inject(self) do |node, key|
67
- begin node.fetch key
70
+ begin node.respond_to?(:fetch) ? node.fetch(key) : node[key]
68
71
  rescue KeyError, IndexError
69
72
  if options[:raise] && options[:raise] != true
70
73
  raise *options[:raise]
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "xkeys"
3
- s.version = "2.0.1"
4
- s.date = "2014-04-16"
3
+ s.version = "2.1.0"
4
+ s.date = "2014-05-06"
5
5
  s.authors = ["Brian Katzung"]
6
6
  s.email = ["briank@kappacs.com"]
7
7
  s.homepage = "http://rubygems.org/gems/xkeys"
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 2
7
- - 0
8
7
  - 1
9
- version: 2.0.1
8
+ - 0
9
+ version: 2.1.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Brian Katzung
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2014-04-16 00:00:00 -05:00
17
+ date: 2014-05-06 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies: []
20
20