Class: StyleScraper
- Inherits:
-
Object
- Object
- StyleScraper
- Defined in:
- lib/hubdown/style_scraper.rb
Instance Method Summary collapse
- #get_css_links ⇒ Object
-
#initialize(uri) ⇒ StyleScraper
constructor
A new instance of StyleScraper.
Constructor Details
#initialize(uri) ⇒ StyleScraper
Returns a new instance of StyleScraper.
7 8 9 10 11 12 13 14 |
# File 'lib/hubdown/style_scraper.rb', line 7 def initialize uri @uri = uri begin @page = Nokogiri::HTML( URI.open( @uri ) ) rescue # do nothing end end |
Instance Method Details
#get_css_links ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/hubdown/style_scraper.rb', line 16 def get_css_links links = [] if @page tag_links = @page.css("link").select{ |link| link['rel'] == 'stylesheet' } tag_links.each do |tag| ss = StyleSheet.new ss.from_tag(tag.to_s) links << ss end end links end |