Class: Atom::Xml::NamespaceMap

Inherits:
Object
  • Object
show all
Defined in:
lib/atom/xml/parser.rb

Instance Method Summary collapse

Constructor Details

#initializeNamespaceMap

Returns a new instance of NamespaceMap.



35
36
37
38
# File 'lib/atom/xml/parser.rb', line 35

def initialize
  @i = 0
  @map = {}
end

Instance Method Details

#each(&block) ⇒ Object



50
51
52
# File 'lib/atom/xml/parser.rb', line 50

def each(&block)
  @map.each(&block)
end

#get(ns) ⇒ Object



40
41
42
43
44
45
46
47
48
# File 'lib/atom/xml/parser.rb', line 40

def get(ns)
  if ns == Atom::NAMESPACE
    @map[ns] = "atom"
  elsif ns == Atom::Pub::NAMESPACE
    @map[ns] = "app"
  else
    @map[ns] or @map[ns] = "ns#{@i += 1}"
  end
end