Method: Atom::Parsers#on_parse_attr

Defined in:
lib/atom/element.rb

#on_parse_attr(name_pair, &block) ⇒ Object

adds a parser that calls the given block for the attribute that matches the given name (if it exists)



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/atom/element.rb', line 86

def on_parse_attr name_pair, &block
  uri, name = name_pair
  @on_parse ||= []

  process = lambda do |e,x|
    x = e.get_atom_attrb(x, name)

    if x
      block.call e, x

      e.extensions.attributes.delete name.to_s
    end
  end

  @on_parse << process
end