Skip to content

Commit

Permalink
fix to_h to not raise on value being an Array
Browse files Browse the repository at this point in the history
  • Loading branch information
svenfuchs committed Oct 15, 2015
1 parent 5833cdf commit b017044
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion hashr.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Gem::Specification.new do |s|
s.summary = "Simple Hash extension to make working with nested hashes (e.g. for configuration) easier and less error-prone"
s.description = "#{s.summary}."

s.files = Dir['{lib/**/*,test/**/*,MIT-LICENSE,README.md,Gemfile}']
s.files = Dir['{lib/**/*,spec/**/*,MIT-LICENSE,README.md,Gemfile}']
s.platform = Gem::Platform::RUBY
s.require_path = 'lib'
s.rubyforge_project = '[none]'
Expand Down
2 changes: 1 addition & 1 deletion lib/hashr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def try(key)

def to_h
@data.inject({}) do |hash, (key, value)|
hash.merge(key => value.respond_to?(:to_h) ? value.to_h : value)
hash.merge(key => value.is_a?(Hashr) || value.is_a?(Hash) ? value.to_h : value)
end
end
alias to_hash to_h
Expand Down

0 comments on commit b017044

Please sign in to comment.