Class: Moxml::Adapter::CustomizedOx::Namespace

Inherits:
Object
  • Object
show all
Defined in:
lib/moxml/adapter/customized_ox/namespace.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(prefix, uri, parent = nil) ⇒ Namespace

Returns a new instance of Namespace.



10
11
12
13
14
# File 'lib/moxml/adapter/customized_ox/namespace.rb', line 10

def initialize(prefix, uri, parent = nil)
  @prefix = prefix
  @uri = uri
  @parent = parent
end

Instance Attribute Details

#parentObject

Returns the value of attribute parent.



7
8
9
# File 'lib/moxml/adapter/customized_ox/namespace.rb', line 7

def parent
  @parent
end

#prefixObject



16
17
18
19
20
# File 'lib/moxml/adapter/customized_ox/namespace.rb', line 16

def prefix
  return if @prefix == "xmlns" || @prefix.nil?

  @prefix.to_s.delete_prefix("xmlns:")
end

#uriObject

Returns the value of attribute uri.



7
8
9
# File 'lib/moxml/adapter/customized_ox/namespace.rb', line 7

def uri
  @uri
end

Instance Method Details

#default?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/moxml/adapter/customized_ox/namespace.rb', line 26

def default?
  prefix.nil?
end

#expanded_prefixObject



22
23
24
# File 'lib/moxml/adapter/customized_ox/namespace.rb', line 22

def expanded_prefix
  ["xmlns", prefix].compact.join(":")
end