rdm 0.0.7 → 0.0.8

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2a03482e98c87a881ac4ec5599126868ae5e9f5e
4
- data.tar.gz: 560f6dce4b59903cbf5bc7308def2f9c5990a3f7
3
+ metadata.gz: a4b6d8edc3b721e97e1198de21d5fca64bf82a77
4
+ data.tar.gz: 0867d57abb893daa476939a0fa6a1adbb4badb4d
5
5
  SHA512:
6
- metadata.gz: 979ab6e554eba662cfffb9a94e3c713e862b10144997fbac30020b5e4bf4f2a6f2d51e10191471c7f9fc0a3dda0c7937789cffeff62946375d64fec21fd4b8fb
7
- data.tar.gz: cf2f6e0b5972663bac717b05659ea17ae1841c50635c4bc67c400bd75c422722477f3056ba2da5d491238dcf9335b1bb62efc14ad9f4e27a8150b388d434ad8c
6
+ metadata.gz: 28dde8933c61a5eee9892afaa1b159371b500e7e6787dbeb2a8a87ec9527cc43ef2d9b286b93a80f449e6b247cb1d7e77e603fb233ca70afe6ea4c30585b94f5
7
+ data.tar.gz: de3929b057b877a871dd3c2d4608f6118f944a167654286e2ace45fbd506df09c95ea44b2be29a866dda9f394279e2120477027b0a1dc7b19201bab8ae5777ce
@@ -54,6 +54,10 @@ class Rdm::ConfigManager
54
54
  root_scope.send(method_name, *args)
55
55
  end
56
56
 
57
+ def to_h
58
+ root_scope.to_h
59
+ end
60
+
57
61
  private
58
62
  def root_scope
59
63
  @root_scope ||= Rdm::ConfigScope.new
@@ -14,4 +14,10 @@ class Rdm::ConfigScope
14
14
  def method_missing(method_name, *args)
15
15
  read_attribute(method_name)
16
16
  end
17
+
18
+ def to_h
19
+ @attributes.each_with_object({}) do |(k, v), h|
20
+ h[k] = Rdm::ConfigScope === v ? v.to_h : v
21
+ end
22
+ end
17
23
  end
@@ -79,7 +79,7 @@ class Rdm::PackageImporter
79
79
  end
80
80
  end
81
81
 
82
- def import_config(config_name, source: source)
82
+ def import_config(config_name, source:)
83
83
  config = source.configs[config_name.to_s]
84
84
  if config == nil
85
85
  raise "Can't find config with name: #{config_name.to_s}"
data/lib/rdm/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rdm
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -63,4 +63,25 @@ describe Rdm::ConfigManager do
63
63
  end
64
64
  end
65
65
  end
66
+
67
+ describe "to_h" do
68
+ before :each do
69
+ subject.update_using_hash(
70
+ site_name: "Sample app",
71
+ database: {
72
+ username: "username",
73
+ password: "password"
74
+ }
75
+ )
76
+ end
77
+
78
+ it "returns attributes in root scope" do
79
+ puts subject.inspect
80
+ expect(subject.to_h["site_name"]).to eq("Sample app")
81
+ end
82
+
83
+ it "returns attributes in child scope" do
84
+ expect(subject.to_h["database"]["username"]).to eq("username")
85
+ end
86
+ end
66
87
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Droid Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-07 00:00:00.000000000 Z
11
+ date: 2016-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler