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

### Methods

<< _build _push add import_variables register

### Public Class methods

register(*args)

[Source]

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

[Source]

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

import_variables(src)

[Source]

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

[Source]

        # File lib/eim_xml/dsl.rb, line 23
    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) {|if block_given?| ...}

[Source]

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

[Validate]