Object
Implementation of a doman specific language for creating configuration objects. Blocks of code are evaluted by the DSL which returns a new configuration object.
Store the string as the description for the next attribute that will be configured. This description will be overwritten if the attribute has a description passed as an options hash.
# File lib/loquacious/configuration.rb, line 247
247: def desc( string )
248: string = string.to_s
249: string.strip!
250: string.gutter!
251: @description = string.empty? ? nil : string
252: end
Dynamically adds the given method to the configuration as an attribute. The args will be used to set the value of the attribute. If a block is given then the args are ignored and the attribute will be a nested configuration object.
# File lib/loquacious/configuration.rb, line 229
229: def method_missing( method, *args, &block )
230: m = method.to_s.delete('=').to_sym
231:
232: if args.length > 1
233: opts = args.last.instance_of?(Hash) ? args.pop : {}
234: self.desc(opts[:desc]) if opts.has_key? :desc
235: end
236:
237: rv = __config.__send(m, *args, &block)
238: __config.__desc[m] = @description if @description
239: @description = nil
240: rv
241: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.