# class EimXML::BaseDSL

### Public Class Methods

register(*args) click to toggle source

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

### Public Instance Methods

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

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

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

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

### Private Instance Methods

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

       # File lib/eim_xml/dsl.rb
    23 def _build(klass, *arg, &proc)
    24         e = klass.new(*arg)
    25         @_container << e if @_container
    26         if proc
    27                 oc = @_container
    28                 @_container = e
    29                 begin
    30                         instance_eval(&proc)
    31                 ensure
    32                         @_container = oc
    33                 end
    34         end
    35         e
    36 end

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

       # File lib/eim_xml/dsl.rb
    39 def _push(container)
    40         oc = @_container
    41         @_container = container
    42         begin
    43                 yield if block_given?
    44                 container
    45         ensure
    46                 @_container = oc
    47         end
    48 end