yamlcon 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c46897559fdbfb770370cb47657073f5cfa877f9
4
+ data.tar.gz: 25ea9362bd0bf4cb4cfed57454714532d83fad76
5
+ SHA512:
6
+ metadata.gz: 977eb592f33dafd30b0b06f5c5a62f57f97b235e1c4646540dd493be547d9bc675837b87f71e1177df76619563350154714fbe57b24ce84dba2fa492f0eec53a
7
+ data.tar.gz: 03958b5a6bb763a419599a22db4ee95f05010ae5f1c9ce2fdae0343895a647a27836b6db680eb7793bc74e7e3fe52006ac284a029bc6552743aa5513063022e4
data/README.md ADDED
@@ -0,0 +1,24 @@
1
+ YAML Config
2
+ ==================================================
3
+
4
+ A utility for loading YAML files as first class configuration objects.
5
+
6
+ Install
7
+ --------------------------------------------------
8
+
9
+ Add to your gemfile
10
+
11
+ ```ruby
12
+ gem 'yaml_conf'
13
+ ```
14
+
15
+ Usage
16
+ --------------------------------------------------
17
+
18
+ ```ruby
19
+ config = YAML.load_config 'path/to/config.yml'
20
+ puts config.any_option.or_nested
21
+ ```
22
+
23
+
24
+
@@ -0,0 +1,3 @@
1
+ module YAMLCon
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,7 @@
1
+ require 'yaml'
2
+
3
+ module YAML
4
+ def self.load_config(file)
5
+ YAMLCon.load_config file
6
+ end
7
+ end
@@ -0,0 +1,19 @@
1
+ require 'yaml'
2
+ require 'ostruct'
3
+
4
+ module YAMLCon
5
+ def self.load_config(file)
6
+ hash = YAML.load_file file
7
+ dot_notation_from hash
8
+ end
9
+
10
+ private
11
+
12
+ def self.dot_notation_from(hash)
13
+ dotted = OpenStruct.new hash
14
+ hash.each do |k, v|
15
+ dotted[k] = dot_notation_from(v) if v.is_a? Hash
16
+ end
17
+ dotted
18
+ end
19
+ end
data/lib/yamlcon.rb ADDED
@@ -0,0 +1,2 @@
1
+ require "yamlcon/yaml_extension"
2
+ require "yamlcon/yamlcon"
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: yamlcon
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Danny Ben Shitrit
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-03-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: runfile
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: run-gem-dev
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.3'
41
+ description: Utility for easily loading YAML files as configuration objects
42
+ email: db@dannyben.com
43
+ executables: []
44
+ extensions: []
45
+ extra_rdoc_files: []
46
+ files:
47
+ - README.md
48
+ - lib/yamlcon.rb
49
+ - lib/yamlcon/version.rb
50
+ - lib/yamlcon/yaml_extension.rb
51
+ - lib/yamlcon/yamlcon.rb
52
+ homepage: https://github.com/DannyBen/yamlcon
53
+ licenses:
54
+ - MIT
55
+ metadata: {}
56
+ post_install_message:
57
+ rdoc_options: []
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: 2.0.0
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ requirements: []
71
+ rubyforge_project:
72
+ rubygems_version: 2.4.6
73
+ signing_key:
74
+ specification_version: 4
75
+ summary: Load YAML as configuration file
76
+ test_files: []