Class: Applitools::Selenium::ExternalCssResources
- Inherits:
-
Object
- Object
- Applitools::Selenium::ExternalCssResources
- Includes:
- CssParser
- Defined in:
- lib/applitools/selenium/external_css_resources.rb
Instance Method Summary collapse
- #flatten_rules ⇒ Object
- #hash ⇒ Object
- #images ⇒ Object
-
#initialize(url, _base_url = nil) ⇒ ExternalCssResources
constructor
A new instance of ExternalCssResources.
Constructor Details
#initialize(url, _base_url = nil) ⇒ ExternalCssResources
Returns a new instance of ExternalCssResources.
8 9 10 11 12 |
# File 'lib/applitools/selenium/external_css_resources.rb', line 8 def initialize(url, _base_url = nil) @parser = CssParser::Parser.new(absolute_paths: true) @parser.load_uri!(url) @parser.compact! end |
Instance Method Details
#flatten_rules ⇒ Object
14 15 16 |
# File 'lib/applitools/selenium/external_css_resources.rb', line 14 def flatten_rules @flatten ||= flatten_hash(hash, 0) end |
#hash ⇒ Object
18 19 20 |
# File 'lib/applitools/selenium/external_css_resources.rb', line 18 def hash @h ||= @parser.to_h end |
#images ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/applitools/selenium/external_css_resources.rb', line 22 def images result = [] @parser.each_rule_set do |s| s. result.push(s) unless s.get_value('background-image').empty? end result end |