dot_hash 0.2.2 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,7 @@
1
1
  module DotHash
2
2
  class Properties
3
3
  attr_reader :hash
4
+ alias_method :to_hash, :hash
4
5
 
5
6
  def initialize(hash)
6
7
  @hash = hash
@@ -6,8 +6,8 @@ module DotHash
6
6
  @configs = Properties.new(configs)
7
7
  end
8
8
 
9
- def method_missing(key)
10
- configs[key]
9
+ def method_missing(*args)
10
+ configs.send(*args)
11
11
  end
12
12
 
13
13
  def respond_to?(key)
@@ -1,3 +1,3 @@
1
1
  module DotHash
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.4"
3
3
  end
@@ -59,6 +59,16 @@ module DotHash
59
59
  end
60
60
  end
61
61
 
62
+ describe "#to_hash" do
63
+ before do
64
+ @properties = Properties.new user: { name: "dude" }
65
+ end
66
+
67
+ it "returns a hash" do
68
+ properties.to_hash.must_equal user: {name: "dude"}
69
+ end
70
+ end
71
+
62
72
  describe "#respond_to?" do
63
73
  before do
64
74
  @properties = Properties.new speed: "15",
@@ -12,10 +12,12 @@ module DotHash
12
12
 
13
13
  it "gets hash properties" do
14
14
  settings.site.must_equal "skyo.com"
15
+ settings[:site].must_equal "skyo.com"
15
16
  end
16
17
 
17
18
  it "gets a nested hash property" do
18
19
  settings.facebook.api.must_equal "123"
20
+ settings['facebook']['api'].must_equal "123"
19
21
  end
20
22
  end
21
23
 
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.2.2
4
+ version: 0.2.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -66,7 +66,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
66
66
  version: '0'
67
67
  segments:
68
68
  - 0
69
- hash: -567602207687414243
69
+ hash: 899670426166528458
70
70
  required_rubygems_version: !ruby/object:Gem::Requirement
71
71
  none: false
72
72
  requirements:
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  version: '0'
76
76
  segments:
77
77
  - 0
78
- hash: -567602207687414243
78
+ hash: 899670426166528458
79
79
  requirements: []
80
80
  rubyforge_project:
81
81
  rubygems_version: 1.8.24