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. Also see the webgen manual for information about the configuration helpers.
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.
124 125 126 127 |
# File 'lib/webgen/configuration.rb', line 124 def initialize @data = {} @meta_info = {} end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(id, *args) ⇒ Object
:nodoc:
147 148 149 |
# File 'lib/webgen/configuration.rb', line 147 def method_missing(id, *args) #:nodoc: MethodChain.new(self).method_missing(id, *args) end |
Instance Attribute Details
#data ⇒ Object (readonly)
The configuration options hash.
121 122 123 |
# File 'lib/webgen/configuration.rb', line 121 def data @data end |
#meta_info ⇒ Object (readonly)
The hash which stores the meta info for the configuration options.
118 119 120 |
# File 'lib/webgen/configuration.rb', line 118 def @meta_info end |
Instance Method Details
#[](name) ⇒ Object
Return the configuration option name
.
130 131 132 133 134 135 136 |
# File 'lib/webgen/configuration.rb', line 130 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
.
139 140 141 142 143 144 145 |
# File 'lib/webgen/configuration.rb', line 139 def []=(name, value) if @data.has_key?(name) @data[name] = value else raise ArgumentError, "No such configuration option: #{name}" end end |