From e3c084439b4c2ccc07ac7609e02136a49eb8d7ce Mon Sep 17 00:00:00 2001 From: Mark Bates Date: Fri, 29 Aug 2008 12:14:14 -0400 Subject: [PATCH] Added/fixed some RDoc. --- README | 6 +++--- Rakefile | 2 +- lib/configuration.rb | 2 +- lib/helpers.rb | 6 +++++- lib/store.rb | 1 + 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README b/README index 82d617d..8875103 100644 --- a/README +++ b/README @@ -37,13 +37,13 @@ The question that should be on your lips is what I need to have namespaced confi configatron do |config| config.website_url = "http://www.mackframework.com" - config.email do |email| - email.pop do |pop| + config.namespace(:email) do |email| + email.namespace(:pop) do |pop| pop.address = "pop.example.com" pop.port = "110" # etc ... end - email.smtp do |smtp| + email.namespace(:smtp) do |smtp| smtp.address = "smtp.example.com" smtp.port = "25" # etc ... diff --git a/Rakefile b/Rakefile index 3ded03b..af742b2 100644 --- a/Rakefile +++ b/Rakefile @@ -13,7 +13,7 @@ require 'pathname' @gem_spec = Gem::Specification.new do |s| s.name = "configatron" - s.version = "1.0.0" + s.version = "1.0.1" s.summary = "A powerful Ruby configuration system." s.description = "Configatron was developed by: markbates" s.author = "markbates" diff --git a/lib/configuration.rb b/lib/configuration.rb index 8280b51..359d877 100644 --- a/lib/configuration.rb +++ b/lib/configuration.rb @@ -68,7 +68,7 @@ def revert(step = 1) reload end - def method_missing(sym, *args) + def method_missing(sym, *args) # :nodoc: handle_missing_parameter(sym) end diff --git a/lib/helpers.rb b/lib/helpers.rb index 3d865d6..31e3919 100644 --- a/lib/helpers.rb +++ b/lib/helpers.rb @@ -1,11 +1,12 @@ module Configatron module Helpers + # Checks whether or not configuration parameter exists. def exists?(name) self.respond_to?(name) end - def handle_missing_parameter(param) + def handle_missing_parameter(param) # :nodoc: if configatron.nil_for_missing return nil else @@ -13,6 +14,9 @@ def handle_missing_parameter(param) end end + # Retrieves the specified config parameter. An optional second + # parameter can be passed that will be returned if the config + # parameter doesn't exist. def retrieve(name, default_value = ArgumentError) return self.send(name) if exists?(name) return default_value unless default_value == ArgumentError diff --git a/lib/store.rb b/lib/store.rb index 939042b..ce27dd8 100644 --- a/lib/store.rb +++ b/lib/store.rb @@ -26,6 +26,7 @@ def method_missing(sym, *args) end end + # Checks whether or not configuration parameter exists. def exists?(name) return true unless @parameters[name.to_sym].nil? super(name)