Class: XMLable::Handlers::Namespace

Inherits:
Object
  • Object
show all
Defined in:
lib/xmlable/handlers/namespace.rb

Overview

Namespace handles XML namespace objects

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(prefix_or_href = nil, href = nil, _opts = {}) ⇒ Namespace

Returns a new instance of Namespace.

Parameters:

  • prefix_or_href (Symbol, String, nil) (defaults to: nil)

    namespace’s URI or prefix

  • href (String) (defaults to: nil)

    namespace’s URI



16
17
18
19
20
21
22
23
# File 'lib/xmlable/handlers/namespace.rb', line 16

def initialize(prefix_or_href = nil, href = nil, _opts = {})
  if prefix.to_s =~ URI.regexp
    @href = prefix_or_href
  else
    @prefix = prefix_or_href
    @href = href
  end
end

Instance Attribute Details

#hrefSymbol (readonly)

Returns namespace’s URI

Returns:

  • (Symbol)

    returns namespace’s URI



10
11
12
# File 'lib/xmlable/handlers/namespace.rb', line 10

def href
  @href
end

#prefixSymbol (readonly)

Returns namespace’s URI

Returns:

  • (Symbol)

    returns namespace’s URI



8
9
10
# File 'lib/xmlable/handlers/namespace.rb', line 8

def prefix
  @prefix
end