# class EimXML::OpenDSL

### Public Class Methods

new() { |self| ... } click to toggle source

    # File lib/eim_xml/dsl.rb, line 90
    def initialize
            @_container = nil
            yield(self) if block_given?
    end

register(*args) click to toggle source

    # File lib/eim_xml/dsl.rb, line 86
    def self.register(*args)
            register_base(self, binding, *args)
    end

register_base(dsl, binding, *args) click to toggle source

    # File lib/eim_xml/dsl.rb, line 78
    def self.register_base(dsl, binding, *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);self.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 95
    def add(v)
            @_container.add(v)
    end

Also aliased as: <<
container() click to toggle source

    # File lib/eim_xml/dsl.rb, line 100
    def container; @_container; end

### Private Instance Methods

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

    # File lib/eim_xml/dsl.rb, line 64
    def _build(klass, *arg, &proc)
            e = klass.new(*arg)
            oc = @_container
            oc << e if oc.is_a?(Element)
            @_container = e
            begin
                    proc.call(self) if proc
                    e
            ensure
                    @_container = oc
            end
    end