Class: Atom::Xml::NamespaceMap
- Inherits:
-
Object
- Object
- Atom::Xml::NamespaceMap
- Defined in:
- lib/atom/xml/parser.rb
Instance Method Summary collapse
- #each(&block) ⇒ Object
- #get(ns) ⇒ Object
-
#initialize ⇒ NamespaceMap
constructor
A new instance of NamespaceMap.
Constructor Details
#initialize ⇒ NamespaceMap
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 |