configutron 0.2.0 → 0.2.1

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.
Files changed (5) hide show
  1. data/Rakefile +1 -1
  2. data/VERSION +1 -1
  3. data/lib/core_ext.rb +21 -0
  4. data/rails/init.rb +1 -0
  5. metadata +2 -1
data/Rakefile CHANGED
@@ -20,7 +20,7 @@ begin
20
20
  "Rakefile",
21
21
  "VERSION",
22
22
  "lib/configutron.rb",
23
- "lib/to_openstruct.rb",
23
+ "lib/core_ext.rb",
24
24
  "rails/init.rb",
25
25
  "spec/configutron_spec.rb",
26
26
  "spec/spec.opts",
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
data/lib/core_ext.rb ADDED
@@ -0,0 +1,21 @@
1
+ # http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/195959
2
+
3
+ class Object
4
+ def to_openstruct
5
+ self
6
+ end
7
+ end
8
+
9
+ class Array
10
+ def to_openstruct
11
+ map{ |el| el.to_openstruct }
12
+ end
13
+ end
14
+
15
+ class Hash
16
+ def to_openstruct
17
+ mapped = {}
18
+ each{ |key,value| mapped[key] = value.to_openstruct }
19
+ OpenStruct.new(mapped)
20
+ end
21
+ end
data/rails/init.rb CHANGED
@@ -1 +1,2 @@
1
+ require "core_ext"
1
2
  require "configutron"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: configutron
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neal Clark
@@ -58,6 +58,7 @@ files:
58
58
  - Rakefile
59
59
  - VERSION
60
60
  - lib/configutron.rb
61
+ - lib/core_ext.rb
61
62
  - rails/init.rb
62
63
  - spec/configutron_spec.rb
63
64
  - spec/fake_rails_root/config/settings/development.yml