Created
July 7, 2009 14:58
-
-
Save ravage/142138 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'ramaze' | |
class MyApp | |
include Ramaze::Optioned | |
options.dsl do | |
o "Application name", :name, "Ramaze DSL Demo" | |
o "Application version", | |
:version, "0.5 Alpha" | |
sub(:db) { | |
o "Database name", | |
:name, "default" | |
o "Credential login name", | |
:login, "oz" | |
o "Credential password", | |
:password, "123456" | |
o "Database host", | |
:host, "localhost" | |
} | |
end | |
end | |
puts MyApp.options.name #=> Ramaze DSL Demo | |
puts MyApp.options.version #=> 0.5 Alpha | |
puts MyApp.options.db.name #=> default | |
puts MyApp.options.db.login #=> oz | |
puts MyApp.options.db.password #=> 123456 | |
puts MyApp.options.db.host #=> localhost |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment