chozo 0.4.1 → 0.4.2

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.
@@ -80,7 +80,7 @@ class Hash
80
80
  return nil unless path.present?
81
81
 
82
82
  parts = path.split('.', 2)
83
- match = (self[parts[0].to_s] || self[parts[0].to_sym])
83
+ match = self[parts[0].to_s].nil? ? self[parts[0].to_sym] : self[parts[0].to_s]
84
84
  if !parts[1] or match.nil?
85
85
  match
86
86
  else
@@ -267,7 +267,7 @@ module Chozo
267
267
  end
268
268
 
269
269
  def whitelist_assign(new_attrs = {})
270
- attributes.dotted_paths.each do |dotted_path|
270
+ self.class.attributes.dotted_paths.each do |dotted_path|
271
271
  value = new_attrs.dig(dotted_path)
272
272
  next if value.nil?
273
273
 
@@ -1,3 +1,3 @@
1
1
  module Chozo
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
@@ -48,7 +48,7 @@ describe Hash do
48
48
  end
49
49
 
50
50
  it "returns the value at the dotted path" do
51
- subject.dig("we.found.something").should be_true
51
+ subject.dig("we.found.something").should eql(true)
52
52
  end
53
53
  end
54
54
 
@@ -77,6 +77,16 @@ describe Hash do
77
77
  it "returns nil if given a blank string" do
78
78
  subject.dig("").should be_nil
79
79
  end
80
+
81
+ it "returns 'false' nested values as 'false' and not 'nil'" do
82
+ hash = {
83
+ "ssl" => {
84
+ "verify" => false
85
+ }
86
+ }
87
+
88
+ hash.dig('ssl.verify').should eql(false)
89
+ end
80
90
  end
81
91
 
82
92
  describe "#dotted_paths" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chozo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  version: '0'
126
126
  segments:
127
127
  - 0
128
- hash: 3156158446945270058
128
+ hash: -2200998191106118860
129
129
  requirements: []
130
130
  rubyforge_project:
131
131
  rubygems_version: 1.8.23