Class: EimXML::OpenDSL

Inherits:
Object
  • Object
show all
Defined in:
lib/eim_xml/dsl.rb

Direct Known Subclasses

XHTML::OpenDSL

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ OpenDSL

Returns a new instance of OpenDSL.

Yields:

  • (_self)

Yield Parameters:



90
91
92
93
# File 'lib/eim_xml/dsl.rb', line 90

def initialize
	@_container = nil
	yield(self) if block_given?
end

Class Method Details

.register(*args) ⇒ Object



86
87
88
# File 'lib/eim_xml/dsl.rb', line 86

def self.register(*args)
	register_base(self, binding, *args)
end

.register_base(dsl, binding, *args) ⇒ Object



78
79
80
81
82
83
84
# 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

Instance Method Details

#add(v) ⇒ Object Also known as: <<



95
96
97
# File 'lib/eim_xml/dsl.rb', line 95

def add(v)
	@_container.add(v)
end

#containerObject



100
# File 'lib/eim_xml/dsl.rb', line 100

def container; @_container; end