dot_hash 0.3.4 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,6 +23,10 @@ module DotHash
23
23
  hash.to_s
24
24
  end
25
25
 
26
+ def to_json
27
+ hash.to_json
28
+ end
29
+
26
30
  def [](key)
27
31
  get_value(key)
28
32
  end
@@ -1,3 +1,3 @@
1
1
  module DotHash
2
- VERSION = "0.3.4"
2
+ VERSION = "0.4.0"
3
3
  end
data/lib/dot_hash.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  $:.push File.expand_path('../', __FILE__)
2
2
 
3
3
  require 'yaml'
4
+ require 'json'
4
5
  require 'dot_hash/properties'
5
6
  require 'dot_hash/hash_to_properties'
6
7
  require 'dot_hash/hash_loader'
@@ -77,6 +77,16 @@ module DotHash
77
77
  end
78
78
  end
79
79
 
80
+ describe "#to_json" do
81
+ before do
82
+ @properties = Properties.new user: { name: "dude" }
83
+ end
84
+
85
+ it "returns a hash" do
86
+ properties.to_json.must_equal '{"user":{"name":"dude"}}'
87
+ end
88
+ end
89
+
80
90
  describe "#to_s" do
81
91
  attr_reader :hash
82
92
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dot_hash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-26 00:00:00.000000000 Z
12
+ date: 2013-05-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -69,7 +69,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
69
69
  version: '0'
70
70
  segments:
71
71
  - 0
72
- hash: -817138279000566861
72
+ hash: -1993425773159925620
73
73
  required_rubygems_version: !ruby/object:Gem::Requirement
74
74
  none: false
75
75
  requirements:
@@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
78
  version: '0'
79
79
  segments:
80
80
  - 0
81
- hash: -817138279000566861
81
+ hash: -1993425773159925620
82
82
  requirements: []
83
83
  rubyforge_project:
84
84
  rubygems_version: 1.8.24