# class EimXML::BaseDSL

### Public Class Methods

register(*args) click to toggle source

    # File lib/eim_xml/dsl.rb, line 51
    def self.register(*args)
            args.each do |klass, name|
                    name ||= klass.name.downcase[/(?:.*\:\:)?(.*)$/, 1]
                    eval("def #{name}(*a, &p);_build(#{klass}, *a, &p);end", binding)
                    eval("def self.#{name}(*a, &p);new.#{name}(*a, &p);end", binding)
            end
    end

### Public Instance Methods

<<(v)
Alias for: add
add(v) click to toggle source

    # File lib/eim_xml/dsl.rb, line 11
    def add(v)
            @_container << v
    end

Also aliased as: <<
import_variables(src) click to toggle source

    # File lib/eim_xml/dsl.rb, line 16
    def import_variables(src)
            src.instance_variables.each do |v|
                    instance_variable_set(v, src.instance_variable_get(v)) unless v=~/\A@_[^_]/
            end
            self
    end

### Private Instance Methods

_build(klass, *arg, &proc) click to toggle source

    # File lib/eim_xml/dsl.rb, line 23
    def _build(klass, *arg, &proc)
            e = klass.new(*arg)
            @_container << e if @_container
            if proc
                    oc = @_container
                    @_container = e
                    begin
                            instance_eval(&proc)
                    ensure
                            @_container = oc
                    end
            end
            e
    end

_push(container) { || ... } click to toggle source

    # File lib/eim_xml/dsl.rb, line 39
    def _push(container)
            oc = @_container
            @_container = container
            begin
                    yield if block_given?
                    container
            ensure
                    @_container = oc
            end
    end