module Xommelier::Xml::Element::Namespace::ClassMethods

Public Instance Methods

xmlns(value = nil) click to toggle source

@return [Xommelier::Xml::Namespace] associated namespace

# File lib/xommelier/xml/element/namespace.rb, line 20
def xmlns(value = nil)
  self.xmlns = value if value
  @xmlns ||= find_namespace
end
xmlns=(value) click to toggle source

@param [Module, Xommelier::Xml::Namespace] value namespace object or module

# File lib/xommelier/xml/element/namespace.rb, line 26
def xmlns=(value)
  @xmlns = case value
           when Module
             value.xmlns
           else
             value
           end
end

Protected Instance Methods

containing_module() click to toggle source

@return [Module, Class]

# File lib/xommelier/xml/element/namespace.rb, line 44
def containing_module
  @containing_module ||= "::#{name.gsub(/::[^:]+$/, '')}".constantize
end
find_namespace() click to toggle source

@return [Xommelier::Xml::Namespace]

# File lib/xommelier/xml/element/namespace.rb, line 49
def find_namespace
  (self == containing_module ? Xommelier::Xml : containing_module).xmlns
end