ruby-conf 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -33,6 +33,7 @@
33
33
  MyBonobo.name # ['Nancy' , 'Drew']
34
34
  MyBonobo.number_of_bananas_eaten # execute proc
35
35
  MyBonobo.number_legs # 2
36
+ RubyConf[:monkey][:age] # 34
36
37
  ...
37
38
 
38
39
  === Anonymous configurations
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.0
1
+ 1.4.0
data/lib/ruby-conf.rb CHANGED
@@ -9,6 +9,10 @@ class RubyConf
9
9
  @attributes = {}
10
10
  end
11
11
 
12
+ def [](name)
13
+ @attributes[name.to_sym]
14
+ end
15
+
12
16
  def method_missing(name, *args, &block)
13
17
  case(args.size)
14
18
  when 0:
@@ -67,6 +71,10 @@ class RubyConf
67
71
  config
68
72
  end
69
73
 
74
+ def self.[](name)
75
+ @@configs[name.to_sym]
76
+ end
77
+
70
78
  def self.method_missing(name, *args, &block)
71
79
  if @@configs.has_key? name.to_sym
72
80
  @@configs[name.to_sym]
data/ruby-conf.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ruby-conf}
8
- s.version = "1.3.0"
8
+ s.version = "1.4.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Curtis Schofield & Hollin Wilkins"]
12
- s.date = %q{2012-01-26}
12
+ s.date = %q{2012-01-27}
13
13
  s.description = %q{rubyconf is a ruby configuration dsl that aims to make it simple to write and read configurations for ruby apps without a yaml or xml file}
14
14
  s.email = %q{blazingpair@blazingcloud.net}
15
15
  s.extra_rdoc_files = [
@@ -64,6 +64,22 @@ describe RubyConf do
64
64
  MyConfig.turtles.mutant.should == true
65
65
  MyConfig.turtles.raphael.mask.should == "red"
66
66
  end
67
+ describe "RubyConf" do
68
+ it "can access configs using square brackets" do
69
+ subject.define "config" do
70
+ shredder "villain"
71
+ end
72
+ subject[:config].shredder.should == "villain"
73
+ end
74
+ end
75
+ describe "RubyConf::Config" do
76
+ it "can access attributes using square brackets" do
77
+ subject.define "config" do
78
+ splinter "the man"
79
+ end
80
+ subject[:config][:splinter].should == "the man"
81
+ end
82
+ end
67
83
  it "defines a new configuration with a given name" do
68
84
  subject.define "thing" do end
69
85
  subject.should respond_to(:thing)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-conf
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 3
8
+ - 4
9
9
  - 0
10
- version: 1.3.0
10
+ version: 1.4.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Curtis Schofield & Hollin Wilkins
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-01-26 00:00:00 -08:00
18
+ date: 2012-01-27 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency