Class: SiteHealth::Checkers::CSSPage
- Inherits:
-
Object
- Object
- SiteHealth::Checkers::CSSPage
- Defined in:
- lib/site_health/checkers/css_page.rb
Instance Attribute Summary collapse
-
#page ⇒ Object
readonly
Returns the value of attribute page.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
- #check ⇒ Object
- #check_content ⇒ W3CValidators::Results
-
#initialize(page) ⇒ CSSPage
constructor
A new instance of CSSPage.
Constructor Details
#initialize(page) ⇒ CSSPage
Returns a new instance of CSSPage.
11 12 13 14 |
# File 'lib/site_health/checkers/css_page.rb', line 11 def initialize(page) @page = page @url = page.url end |
Instance Attribute Details
#page ⇒ Object (readonly)
Returns the value of attribute page.
8 9 10 |
# File 'lib/site_health/checkers/css_page.rb', line 8 def page @page end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
8 9 10 |
# File 'lib/site_health/checkers/css_page.rb', line 8 def url @url end |
Class Method Details
.check(page) ⇒ Object
4 5 6 |
# File 'lib/site_health/checkers/css_page.rb', line 4 def self.check(page) new(page).check end |
Instance Method Details
#check ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/site_health/checkers/css_page.rb', line 16 def check result = check_content CSSJournal.new( url: url, page: page, errors: result.errors.map { |e| W3CJournalBuilder.build(e) }, warnings: result.warnings.map { |e| W3CJournalBuilder.build(e) } ) end |
#check_content ⇒ W3CValidators::Results
30 31 32 33 |
# File 'lib/site_health/checkers/css_page.rb', line 30 def check_content validator = W3CValidators::CSSValidator.new validator.validate_uri(url) end |