Parent

Loquacious::Undefined

Represents an undefined configuration value. An undefined value is assigned to each configuration propery by default. Any method can be invoked on an undefined value, and a warning message will be printed to the IO stream (defaulting to $stderr).

The purpose of this class is to provide the user with a helpful message that the configuration values they are trying to use have not been setup correctly.

Constants

Keepers

Attributes

io[RW]

Public Class Methods

new( key ) click to toggle source

Creates a new undefined value returned from the lookup key in some configuration object. The key is used to alert the user where the undefined value came from.

    # File lib/loquacious/undefined.rb, line 63
63:     def initialize( key )
64:       @key = Kernel.Array(key)
65:     end
warn( key ) click to toggle source

Write a warning message to the Undefined class IO stream. By default, this IO stream is set to the Ruby $stderr output.

    # File lib/loquacious/undefined.rb, line 42
42:       def warn( key )
43:         if @first_time
44:           @io.puts ---------------------------------------------------------------------------The Loquacious configuration system has detected that one or moesettings have an undefined value. An attempt is being made to referencesub-properties of these undefined settings. Messages will follow containinginformation about the undefined properties.---------------------------------------------------------------------------
45:           @first_time = false
46:         end
47: 
48:         @io.puts "Access to undefined value #{key.first.inspect}: #{key.join('.')}"
49:       end

Public Instance Methods

method_missing( method, *args, &block ) click to toggle source

For every method invoked on an undefined object, generate a warning message describing the undefined value and the method that was called.

Returns a new undefined object with the most recent method included in the key name.

    # File lib/loquacious/undefined.rb, line 84
84:     def method_missing( method, *args, &block )
85:       key = @key.dup << method.to_s
86:       Undefined.warn key
87:       return Undefined.new key
88:     end
nil?() click to toggle source

An undefined value acts like a nil in that it has no value of its own. This method always returns true.

    # File lib/loquacious/undefined.rb, line 70
70:     def nil?() true; end
respond_to_missing?( id, priv = false ) click to toggle source

We can respond to any method except :call. The call method is reserved for Procs and lambdas, and it is used internally by loquacious for lazy evaluation of configuration parameters.

    # File lib/loquacious/undefined.rb, line 76
76:     def respond_to_missing?( id, priv = false ) id != :call; end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.