serenity 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +20 -1
- data/VERSION +1 -1
- data/lib/serenity.rb +17 -0
- data/serenity.gemspec +3 -3
- metadata +20 -9
data/README.rdoc
CHANGED
@@ -1,6 +1,25 @@
|
|
1
1
|
= serenity
|
2
2
|
|
3
|
-
|
3
|
+
Returns values from multi-level YAML configuration files.
|
4
|
+
|
5
|
+
Gracefully handles error messages when an option is not found.
|
6
|
+
|
7
|
+
== Usage
|
8
|
+
|
9
|
+
Given config.yml:
|
10
|
+
|
11
|
+
name: Fred Flintstone
|
12
|
+
wife:
|
13
|
+
name: Wilma Flintstone
|
14
|
+
friend:
|
15
|
+
name: Barney Rubble
|
16
|
+
wife: Betty Rubble
|
17
|
+
|
18
|
+
@config = Serenity::Configuration.new("config.yml")
|
19
|
+
|
20
|
+
@config.get("name") #=> "Fred Flinstone"
|
21
|
+
@config.get("wife", "name") #=> "Wilma Flintstone"
|
22
|
+
|
4
23
|
|
5
24
|
== Note on Patches/Pull Requests
|
6
25
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/lib/serenity.rb
CHANGED
@@ -31,6 +31,23 @@ module Serenity
|
|
31
31
|
def to_hash
|
32
32
|
options
|
33
33
|
end
|
34
|
+
|
35
|
+
def exists?(*args)
|
36
|
+
c = options
|
37
|
+
|
38
|
+
missing_option_index = 0
|
39
|
+
|
40
|
+
args.each_with_index do |arg, i|
|
41
|
+
if c.is_a?(Hash) && c.has_key?(arg)
|
42
|
+
c = c[arg]
|
43
|
+
else
|
44
|
+
missing_option_index = i
|
45
|
+
c = nil
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
c
|
50
|
+
end
|
34
51
|
|
35
52
|
def get(*args)
|
36
53
|
c = options
|
data/serenity.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{serenity}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jeff Coleman"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-05-07}
|
13
13
|
s.description = %q{Handles configuration options from Yaml files, returning multi-level values with appropriate error messaging.}
|
14
14
|
s.email = %q{progressions@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
|
|
32
32
|
s.homepage = %q{http://github.com/progressions/serenity}
|
33
33
|
s.rdoc_options = ["--charset=UTF-8"]
|
34
34
|
s.require_paths = ["lib"]
|
35
|
-
s.rubygems_version = %q{1.3.
|
35
|
+
s.rubygems_version = %q{1.3.6}
|
36
36
|
s.summary = %q{Gracefully handles multi-level configuration options from Yaml files}
|
37
37
|
s.test_files = [
|
38
38
|
"spec/serenity_spec.rb",
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serenity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Jeff Coleman
|
@@ -9,19 +14,23 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date: 2010-
|
17
|
+
date: 2010-05-07 00:00:00 -05:00
|
13
18
|
default_executable:
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: rspec
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
24
|
requirements:
|
21
25
|
- - ">="
|
22
26
|
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 1
|
29
|
+
- 2
|
30
|
+
- 6
|
23
31
|
version: 1.2.6
|
24
|
-
|
32
|
+
type: :development
|
33
|
+
version_requirements: *id001
|
25
34
|
description: Handles configuration options from Yaml files, returning multi-level values with appropriate error messaging.
|
26
35
|
email: progressions@gmail.com
|
27
36
|
executables: []
|
@@ -56,18 +65,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
56
65
|
requirements:
|
57
66
|
- - ">="
|
58
67
|
- !ruby/object:Gem::Version
|
68
|
+
segments:
|
69
|
+
- 0
|
59
70
|
version: "0"
|
60
|
-
version:
|
61
71
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
72
|
requirements:
|
63
73
|
- - ">="
|
64
74
|
- !ruby/object:Gem::Version
|
75
|
+
segments:
|
76
|
+
- 0
|
65
77
|
version: "0"
|
66
|
-
version:
|
67
78
|
requirements: []
|
68
79
|
|
69
80
|
rubyforge_project:
|
70
|
-
rubygems_version: 1.3.
|
81
|
+
rubygems_version: 1.3.6
|
71
82
|
signing_key:
|
72
83
|
specification_version: 3
|
73
84
|
summary: Gracefully handles multi-level configuration options from Yaml files
|