Module: Wayfarer::Finders

Included in:
Page
Defined in:
lib/wayfarer/finders.rb

Instance Method Summary collapse

Instance Method Details

#images(*filters) ⇒ Array<URI>

Returns the expanded src attribute URIs from all or targeted <img> tags. TODO: Tests

Parameters:

  • filters (*Array<String>)

    CSS/XPath expressions.

Returns:

  • (Array<URI>)

33
34
35
# File 'lib/wayfarer/finders.rb', line 33

def images(*filters)
  query("img", "src", *filters)
end

#javascripts(*filters) ⇒ Array<URI> Also known as: scripts

Returns the expanded src attribute URIs from all or targeted <script> tags. TODO: Tests

Parameters:

  • filters (*Array<String>)

    CSS/XPath expressions.

Returns:

  • (Array<URI>)

23
24
25
# File 'lib/wayfarer/finders.rb', line 23

def javascripts(*filters)
  query("script", "src", *filters)
end

Returns the expanded href attribute URIs from all or targeted <a> tags.

Parameters:

  • filters (*Array<String>)

    CSS/XPath expressions.

Returns:

  • (Array<URI>)

8
9
10
# File 'lib/wayfarer/finders.rb', line 8

def links(*filters)
  query("a", "href", *filters)
end

#stylesheets(*filters) ⇒ Array<URI>

Returns the expanded href attribute URIs from all or targeted <link rel="stylesheet" ...> tags.

Parameters:

  • filters (*Array<String>)

    CSS/XPath expressions.

Returns:

  • (Array<URI>)

15
16
17
# File 'lib/wayfarer/finders.rb', line 15

def stylesheets(*filters)
  query("link[rel='stylesheet']", "href", *filters)
end