166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
# File 'lib/charles/document.rb', line 166
def match(queries = [])
[].tap do |results|
[*queries].each do |query|
result = begin
if query.is_a?(String)
if el = self.search(query).first
if el.name.downcase == "meta"
el['content']
else
el.inner_text
end
end
elsif query.is_a?(Array)
query.last.call( self.search(query.first).first )
end
rescue
nil
end
results << Charles::Misc.normalize_string(result) if result
end
end.compact
end
|