# class EimXML::OpenDSL

### Public Class Methods

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

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

register(*args) click to toggle source

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

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

       # File lib/eim_xml/dsl.rb
    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) click to toggle source

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

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

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

### Private Instance Methods

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

       # File lib/eim_xml/dsl.rb
    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