Class | EimXML::OpenDSL
In: | lib/eim_xml/dsl.rb
Parent: | Object

### Methods

<< _build add container new register register_base

### Public Class methods

new() {|self| ...}

[Source]

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

register(*args)

[Source]

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

register_base(dsl, binding, *args)

[Source]

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

### Public Instance methods

<<(v)

Alias for add

add(v)

[Source]

        # File lib/eim_xml/dsl.rb, line 95
    95:                 def add(v)
    96:                         @_container.add(v)
    97:                 end

container()

[Source]

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

### Private Instance methods

_build(klass, *arg, &proc)

[Source]

        # File lib/eim_xml/dsl.rb, line 64
    64:                 def _build(klass, *arg, &proc)
    65:                         e = klass.new(*arg)
    66:                         oc = @_container
    67:                         oc << e if oc.is_a?(Element)
    68:                         @_container = e
    69:                         begin
    70:                                 proc.call(self) if proc
    71:                                 e
    72:                         ensure
    73:                                 @_container = oc
    74:                         end
    75:                 end

[Validate]