navigable_hash 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # NavigableHash
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/navigable_hash.png)](http://badge.fury.io/rb/navigable_hash)
3
4
  [![Build Status](https://travis-ci.org/jwaldrip/navigable_hash.png?branch=master)](https://travis-ci.org/jwaldrip/navigable_hash)
4
5
  [![Coverage Status](https://coveralls.io/repos/jwaldrip/navigable_hash/badge.png?branch=master)](https://coveralls.io/r/jwaldrip/navigable_hash)
5
6
  [![Code Climate](https://codeclimate.com/github/jwaldrip/navigable_hash.png)](https://codeclimate.com/github/jwaldrip/navigable_hash)
6
- [![Dependency Status](https://gemnasium.com/jwaldrip/navigable_hash.png)](https://gemnasium.com/jwaldrip/navigable_hash)
7
7
 
8
8
  NavigableHash was built as lightweight and quick way to navigate through a hash or array object using the familiar ruby dot notation. See 'Usage' below for examples. Keys as strings or symbols don't matter, its all included.
9
9
 
@@ -78,7 +78,7 @@ class NavigableHash < Hash
78
78
  end
79
79
 
80
80
  def respond_to?(m, include_private = false)
81
- true
81
+ has_key?(m) || super
82
82
  end
83
83
 
84
84
  def to_hash
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "navigable_hash"
7
- spec.version = "1.0.0"
7
+ spec.version = "1.0.1"
8
8
  spec.authors = ["Jason Waldrip", "Kevin Wanek"]
9
9
  spec.email = ["jason@waldrip.net", "k@dmcy.us"]
10
10
  spec.description = %q{Allows a hash to be navigated with dot notation or indifferent access.}
@@ -79,7 +79,7 @@ describe NavigableHash do
79
79
  end
80
80
 
81
81
  it "should set a value" do
82
- expect { navigable.__any_method__ = 'value' }.to change { navigable.__any_method__ }
82
+ expect { navigable.__any_method__ = 'value' }.to change { navigable[:__any_method__] }
83
83
  end
84
84
 
85
85
  it "should raise an error with more than one argument" do
@@ -237,8 +237,23 @@ describe NavigableHash do
237
237
  end
238
238
 
239
239
  describe "#respond_to?" do
240
- it "should always be true" do
241
- navigable.respond_to?(:this_is_not_a_method).should be_true
240
+ context "if the key exists" do
241
+ it "should be " do
242
+ navigable.respond_to?(:this_is_not_a_method).should be_false
243
+ end
244
+ end
245
+
246
+ context "if the key does not exist" do
247
+ it "should be " do
248
+ navigable[:this_is_not_a_method] = "Hello"
249
+ navigable.respond_to?(:this_is_not_a_method).should be_true
250
+ end
251
+ end
252
+
253
+ context "with a real method" do
254
+ it "should be true" do
255
+ navigable.respond_to?(:to_hash).should be_true
256
+ end
242
257
  end
243
258
  end
244
259
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: navigable_hash
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-03-29 00:00:00.000000000 Z
13
+ date: 2013-04-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  version: '0'
151
151
  requirements: []
152
152
  rubyforge_project:
153
- rubygems_version: 1.8.25
153
+ rubygems_version: 1.8.23
154
154
  signing_key:
155
155
  specification_version: 3
156
156
  summary: Allows a hash to be navigated with dot notation or indifferent access.