Module: XML::SAX::AttributeList

Defined in:
lib/rfeedparser/better_attributelist.rb

Overview

in xml/sax.rb

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ Object



10
11
12
# File 'lib/rfeedparser/better_attributelist.rb', line 10

def [](key)
  getValue(key)
end

#each(&blk) ⇒ Object



14
15
16
# File 'lib/rfeedparser/better_attributelist.rb', line 14

def each(&blk)
  (0...getLength).each{|pos| yield [getName(pos), getValue(pos)]}
end

#each_key(&blk) ⇒ Object



18
19
20
# File 'lib/rfeedparser/better_attributelist.rb', line 18

def each_key(&blk)
  (0...getLength).each{|pos| yield getName(pos) }
end

#each_value(&blk) ⇒ Object



22
23
24
# File 'lib/rfeedparser/better_attributelist.rb', line 22

def each_value(&blk)
  (0...getLength).each{|pos| yield getValue(pos) }
end

#to_aObject

Rather use collect? grep for to_a.collect



26
27
28
29
30
# File 'lib/rfeedparser/better_attributelist.rb', line 26

def to_a # Rather use collect? grep for to_a.collect
  l = []
  each{|k,v| l << [k,v]}
  return l
end

#to_sObject



32
33
34
35
36
# File 'lib/rfeedparser/better_attributelist.rb', line 32

def to_s
  l = []
  each{|k,v| l << "#{k} => #{v}"}
  "{ "+l.join(", ")+" }"
end