Sha256: 9ce065894a6616248e576103eda19bacbf97ea06b43a50b4841cd6e177932add

Contents?: true

Size: 502 Bytes

Versions: 8

Compression:

Stored size: 502 Bytes

Contents

require 'nokogiri'
require 'open-uri'
require 'hubdown/style_sheet'

class StyleScraper

  def initialize uri
    @uri = uri
    begin
      @page = Nokogiri::HTML( open( @uri ) )
    rescue
      # do nothing
    end
  end

  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


end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
hubdown-0.0.15 lib/hubdown/style_scraper.rb
hubdown-0.0.14 lib/hubdown/style_scraper.rb
hubdown-0.0.13 lib/hubdown/style_scraper.rb
hubdown-0.0.12 lib/hubdown/style_scraper.rb
hubdown-0.0.11 lib/hubdown/style_scraper.rb
hubdown-0.0.10 lib/hubdown/style_scraper.rb
hubdown-0.0.9 lib/hubdown/style_scraper.rb
hubdown-0.0.8 lib/hubdown/style_scraper.rb