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.



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

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

Instance Attribute Details

#parentObject

Returns the value of attribute parent.



9
10
11
# File 'lib/moxml/adapter/customized_ox/namespace.rb', line 9

def parent
  @parent
end

#prefixObject



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

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

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

#uriObject

Returns the value of attribute uri.



9
10
11
# File 'lib/moxml/adapter/customized_ox/namespace.rb', line 9

def uri
  @uri
end

Instance Method Details

#default?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/moxml/adapter/customized_ox/namespace.rb', line 28

def default?
  prefix.nil?
end

#expanded_prefixObject



24
25
26
# File 'lib/moxml/adapter/customized_ox/namespace.rb', line 24

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