Class: Oga::XML::Namespace

Inherits:
Object
  • Object
show all
Defined in:
lib/oga/xml/namespace.rb

Overview

The Namespace class contains information about XML namespaces such as the name and URI.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Namespace

Returns a new instance of Namespace

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :name (String)
  • :uri (String)


16
17
18
19
# File 'lib/oga/xml/namespace.rb', line 16

def initialize(options = {})
  @name = options[:name]
  @uri  = options[:uri]
end

Instance Attribute Details

#nameString

Returns:

  • (String)


7
8
9
# File 'lib/oga/xml/namespace.rb', line 7

def name
  @name
end

#uriString

Returns:

  • (String)


10
11
12
# File 'lib/oga/xml/namespace.rb', line 10

def uri
  @uri
end

Instance Method Details

#==(other) ⇒ TrueClass|FalseClass

Parameters:

Returns:

  • (TrueClass|FalseClass)


33
34
35
# File 'lib/oga/xml/namespace.rb', line 33

def ==(other)
  other.is_a?(self.class) && name == other.name && uri == other.uri
end

#inspectString

Returns:

  • (String)


27
28
29
# File 'lib/oga/xml/namespace.rb', line 27

def inspect
  "Namespace(name: #{name.inspect} uri: #{uri.inspect})"
end

#to_sString

Returns:

  • (String)


22
23
24
# File 'lib/oga/xml/namespace.rb', line 22

def to_s
  name.to_s
end