Class: Webgen::Configuration
- Inherits:
-
Object
- Object
- Webgen::Configuration
- Includes:
- Helpers
- Defined in:
- lib/webgen/configuration.rb
Overview
Stores the configuration for a webgen website.
Configuration options should be created like this:
config.my.new.config 'value', :doc => 'some', :meta => 'info'
and later accessed or set using the accessor methods #[] and #[]= or a configuration helper. These helpers are defined in the Helpers module and provide easier access to complex configuration options.
Defined Under Namespace
Modules: Helpers Classes: MethodChain
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
The configuration options hash.
-
#meta_info ⇒ Object
readonly
The hash which stores the meta info for the configuration options.
Instance Method Summary collapse
-
#[](name) ⇒ Object
Return the configuration option
name
. -
#[]=(name, value) ⇒ Object
Set the configuration option
name
to the providedvalue
. -
#initialize ⇒ Configuration
constructor
Create a new Configuration object.
-
#method_missing(id, *args) ⇒ Object
:nodoc:.
Methods included from Helpers
#default_meta_info, #default_processing_pipeline, #patterns
Constructor Details
#initialize ⇒ Configuration
Create a new Configuration object.
122 123 124 125 |
# File 'lib/webgen/configuration.rb', line 122 def initialize @data = {} = {} end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(id, *args) ⇒ Object
:nodoc:
145 146 147 |
# File 'lib/webgen/configuration.rb', line 145 def method_missing(id, *args) #:nodoc: MethodChain.new(self).method_missing(id, *args) end |
Instance Attribute Details
#data ⇒ Object (readonly)
The configuration options hash.
119 120 121 |
# File 'lib/webgen/configuration.rb', line 119 def data @data end |
#meta_info ⇒ Object (readonly)
The hash which stores the meta info for the configuration options.
116 117 118 |
# File 'lib/webgen/configuration.rb', line 116 def end |
Instance Method Details
#[](name) ⇒ Object
Return the configuration option name
.
128 129 130 131 132 133 134 |
# File 'lib/webgen/configuration.rb', line 128 def [](name) if @data.has_key?(name) @data[name] else raise ArgumentError, "No such configuration option: #{name}" end end |
#[]=(name, value) ⇒ Object
Set the configuration option name
to the provided value
.
137 138 139 140 141 142 143 |
# File 'lib/webgen/configuration.rb', line 137 def []=(name, value) if @data.has_key?(name) @data[name] = value else raise ArgumentError, "No such configuration option: #{name}" end end |