mashed 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/mashed/mash.rb CHANGED
@@ -17,7 +17,7 @@ module Mashed
17
17
  end
18
18
 
19
19
  def to_hash
20
- @hash.to_hash
20
+ unwrap @hash
21
21
  end
22
22
  alias to_h to_hash
23
23
 
@@ -3,7 +3,10 @@ require 'delegate'
3
3
  module Mashed
4
4
  module ExtendHash
5
5
  def stringify
6
- StringyHash.new(dup.each_with_object({}) { |(k,v), h| h[k.to_s] = v })
6
+ StringyHash.new(dup.each_with_object({}) do |(k,v), h|
7
+ v = v.stringify if v.respond_to?(:stringify)
8
+ h[k.to_s] = v
9
+ end)
7
10
  end
8
11
  end
9
12
 
@@ -1,3 +1,3 @@
1
1
  module Mashed
2
- VERSION = "0.4.0"
2
+ VERSION = "0.5.0"
3
3
  end
@@ -58,7 +58,7 @@ describe Mashed::Mash do
58
58
  let(:nested) { Mashed::Mash.new(inside: { of: 'you' }) }
59
59
  let(:hash) { nested.to_hash }
60
60
  it { expect(hash["inside"]).to be_a(Hash) }
61
- it { expect(nested["inside"]["of"]).to eq('you') }
61
+ it { expect(hash["inside"]["of"]).to eq('you') }
62
62
  end
63
63
 
64
64
  describe "query methods should return booleans" do
@@ -1,9 +1,9 @@
1
1
  require "spec_helper"
2
2
 
3
3
  describe Mashed::StringyHash do
4
- let(:hash) {{ a: 1, b: 2, c: 3 }}
4
+ let(:hash) {{ a: 1, b: 2, c: { three: 3 }}}
5
5
 
6
6
  describe "#stringify" do
7
- it { expect(hash.stringify).to eq("a" => 1, "b" => 2, "c" => 3) }
7
+ it { expect(hash.stringify).to eq("a" => 1, "b" => 2, "c" => { "three" => 3 }) }
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mashed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: