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

Options Hash (options):

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

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

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

Instance Attribute Details

#nameString


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/oga/xml/namespace.rb', line 13

class Namespace
  attr_accessor :name, :uri

  ##
  # @param [Hash] options
  #
  # @option options [String] :name
  # @option options [String] :uri
  #
  def initialize(options = {})
    @name = options[:name]
    @uri  = options[:uri]
  end

  ##
  # @return [String]
  #
  def to_s
    return name.to_s
  end

  ##
  # @return [String]
  #
  def inspect
    return "Namespace(name: #{name.inspect} uri: #{uri.inspect})"
  end
end

#uriString


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/oga/xml/namespace.rb', line 13

class Namespace
  attr_accessor :name, :uri

  ##
  # @param [Hash] options
  #
  # @option options [String] :name
  # @option options [String] :uri
  #
  def initialize(options = {})
    @name = options[:name]
    @uri  = options[:uri]
  end

  ##
  # @return [String]
  #
  def to_s
    return name.to_s
  end

  ##
  # @return [String]
  #
  def inspect
    return "Namespace(name: #{name.inspect} uri: #{uri.inspect})"
  end
end

Instance Method Details

#inspectString


37
38
39
# File 'lib/oga/xml/namespace.rb', line 37

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

#to_sString


30
31
32
# File 'lib/oga/xml/namespace.rb', line 30

def to_s
  return name.to_s
end