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)


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

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

Instance Attribute Details

#nameString

Returns:

  • (String)


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

def name
  @name
end

#uriString

Returns:

  • (String)


12
13
14
# File 'lib/oga/xml/namespace.rb', line 12

def uri
  @uri
end

Instance Method Details

#==(other) ⇒ TrueClass|FalseClass

Parameters:

Returns:

  • (TrueClass|FalseClass)


43
44
45
# File 'lib/oga/xml/namespace.rb', line 43

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

#inspectString

Returns:

  • (String)


35
36
37
# File 'lib/oga/xml/namespace.rb', line 35

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

#to_sString

Returns:

  • (String)


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

def to_s
  name.to_s
end