Class: EimXML::BaseDSL
- Inherits:
-
Object
- Object
- EimXML::BaseDSL
- Defined in:
- lib/eim_xml/dsl.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
- #add(v) ⇒ Object (also: #<<)
- #import_variables(src) ⇒ Object
Class Method Details
.register(*args) ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/eim_xml/dsl.rb', line 51 def self.register(*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);new.#{name}(*a, &p);end", binding) end end |
Instance Method Details
#add(v) ⇒ Object Also known as: <<
11 12 13 |
# File 'lib/eim_xml/dsl.rb', line 11 def add(v) @_container << v end |
#import_variables(src) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/eim_xml/dsl.rb', line 16 def import_variables(src) src.instance_variables.each do |v| instance_variable_set(v, src.instance_variable_get(v)) unless v=~/\A@_[^_]/ end self end |