class ActiveXML::Collection::Query
Public Class Methods
new(path, where_values)
click to toggle source
Calls superclass method
ActiveXML::new
# File lib/active_xml/collection/query.rb, line 4 def initialize(path, where_values) super(path) @where_key = where_values.keys.first @where_value = where_values.values.first end
Private Instance Methods
each() { |elem| ... }
click to toggle source
# File lib/active_xml/collection/query.rb, line 12 def each xml.child.elements.each do |elem| yield(elem) if in_where?(elem) end end
in_where?(elem)
click to toggle source
# File lib/active_xml/collection/query.rb, line 18 def in_where?(elem) if @where_value.is_a?(Array) @where_value.any?{|object| fetch_contents(elem.elements, @where_key).first == object.to_s} else fetch_contents(elem.elements, @where_key).first == @where_value.to_s end end