Method: Representable::XML::Namespace::DSL#update_namespace_defs!

Defined in:
lib/representable/xml/namespace.rb

#update_namespace_defs!(namespace_defs) ⇒ Object

:private: super ugly hack recursively injects the namespace_defs into all representers of this tree. will be done better in 4.0.



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/representable/xml/namespace.rb', line 48

def update_namespace_defs!(namespace_defs)
  representable_attrs.each do |dfn|
    dfn.merge!(namespace_defs: namespace_defs) # this only helps with scalars

    if dfn.typed?
      representer = Class.new(dfn.representer_module) # don't pollute classes.
      representer.update_namespace_defs!(namespace_defs)
      dfn.merge!(extend: representer)
    end
  end
end