README.rdoc in ruby-conf-1.1.0 vs README.rdoc in ruby-conf-1.3.0
- old
+ new
@@ -21,18 +21,40 @@
has_legs true
number_arms 2
number_legs 2
name 'Nancy' , 'Drew'
age 34
+
+ # make sure to pass a lambda and not a do block
+ # do blocks chain configurations (see below)
number_of_bananas_eaten lambda {
BanannaChomper.lookup("nancy.bananas").count
}
end
MyBonobo.name # ['Nancy' , 'Drew']
MyBonobo.number_of_bananas_eaten # execute proc
MyBonobo.number_legs # 2
...
+=== Anonymous configurations
+ config = RubyConf.define do
+ favorite_color 'blue'
+ end
+ config.favorite_color # "blue"
+
+=== Configuration chaining
+ RubyConf.define "rails", :as => :RailsConfig do
+ production do
+ database "rails_prod"
+ host "localhost"
+ end
+ staging do
+ database "rails_staging"
+ host "localhost"
+ end
+ end
+ RailsConfig.production.database # "rails_prod"
+ RailsConfig.staging.database # "rails_staging"
== Contributing to ruby-conf
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.