Class: DbDom::Rexml::DynamicElement

Inherits:
Element
  • Object
show all
Extended by:
Advice
Defined in:
lib/rexml.rb

Direct Known Subclasses

DbElement, TableElement

Constant Summary collapse

EVERY_SINGLE_PARENT_METHOD =

this is super-lame i can’t find a way to intercept instance var access and the REXML Parent class does not provide an initialization hook so we basically have to wrap each and every method (well, at least the ones that interact with the @children var), in order to be able to invoke an initialization method either the design of the Parent class sucks, or I’m just missing some great idiomatic way to do this

[ :add, :push, :<<, :unshift, :delete,
:each, :delete_if, :delete_at, :each_index,
:each_child, :[]=, :insert_before, :insert_after,
:to_a, :index, :size, :length, :children,
:replace_child, :deep_clone ]

Instance Method Summary collapse

Methods included from Advice

advise, advise_after, advise_before

Constructor Details

#initialize(name, parent, context) ⇒ DynamicElement

Returns a new instance of DynamicElement.



39
40
41
42
43
# File 'lib/rexml.rb', line 39

def initialize(name, parent, context)
    super(name, parent, context)
    @children_initialized = false
    @initializing = false # hack to avoid re-entrancy
end

Instance Method Details

#init_childrenObject



53
54
# File 'lib/rexml.rb', line 53

def init_children
end

#initialize_children(method, *args) ⇒ Object



45
46
47
48
49
50
51
# File 'lib/rexml.rb', line 45

def initialize_children(method, *args)
    return if @children_initialized || @initializing
    @initializing = true
    init_children
    @children_initialized = true
    @initializing = false
end