Class: Configuration::DSL

### Home Classes Methods

### In Files

- lib/configuration.rb

### Parent

Object

### Methods

- ::evaluate
- ::new
- #Method
- #Send
- #__configuration__
- #method_missing
- #object_id

### Class/Module Index

Quicksearch

- Configuration
- Configuration::ClassMethods
- Configuration::DSL
- Configuration::InstanceMethods
- Configuration::Pure
- Object

No matching classes.

# Configuration::DSL

### Constants

Protected

### Public Class Methods

evaluate(configuration, options = {}) click to toggle source

    # File lib/configuration.rb, line 139
    def self.evaluate configuration, options = {}, &block
      dsl = new configuration

      options.each{|key, value| Pure[dsl].send key, value}
      Pure[dsl].instance_eval(&block) if block

      Pure[dsl].instance_eval{ @__configuration }
    end

new(configuration, &block) click to toggle source

    # File lib/configuration.rb, line 148
    def initialize configuration, &block
      @__configuration = configuration
      @__singleton_class =
        class << @__configuration
          self
        end
    end

### Public Instance Methods

Method(m) click to toggle source

    # File lib/configuration.rb, line 135
    def Method m
      @__configuration.method(m)
    end

Send(m, *a, &b) click to toggle source

    # File lib/configuration.rb, line 131
    def Send(m, *a, &b)
      Method(m).call(*a, &b)
    end

__configuration__() click to toggle source

    # File lib/configuration.rb, line 156
    def __configuration__
      @__configuration
    end

method_missing(m, *a, &b) click to toggle source

    # File lib/configuration.rb, line 161
    def method_missing(m, *a, &b)
      if(a.empty? and b.nil?)
        return Pure[@__configuration].send(m, *a, &b)
      end
      if b
        raise ArgumentError unless a.empty?
        parent = @__configuration
        name = m.to_s
        configuration =
          if @__configuration.respond_to?(name) and Configuration === @__configuration.send(name)
            @__configuration.send name
          else
            Configuration.new name
          end
        Pure[configuration].instance_eval{ @__parent = parent }
        DSL.evaluate configuration, &b
        value = configuration
      end
      unless a.empty?
        value = a.size == 1 ? a.first : a
      end
      @__singleton_class.module_eval do
        define_method(m){ value }
      end
    end

object_id(*args) click to toggle source

    # File lib/configuration.rb, line 190
    def object_id(*args)
      unless args.empty?
        verbose = $VERBOSE
        begin
          $VERBOSE = nil
          define_method(:object_id){ args.first }
        ensure
          $VERBOSE = verbose
        end
      else
        return Pure[@__configuration].object_id
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.