class CssCompare::Engine

The engine responsible for the CSS comparison

Public Class Methods

new(options) click to toggle source
# File lib/css_compare/engine.rb, line 6
def initialize(options)
  @options = options
  @operands = []
end

Public Instance Methods

equal?() click to toggle source

Checks, whether the parsed CSS files are equal.

The CSS files are equal, if they define the same components, that are also equal and at the same time, no component is missing from either of the files.

@return [Boolean]

# File lib/css_compare/engine.rb, line 27
def equal?
  @operands.first == @operands.last
end
parse!() click to toggle source

Parses and evaluates the input CSS stylesheets - the operands.

@return [Engine] itself for method chaining purposes

# File lib/css_compare/engine.rb, line 14
def parse!
  @options[:operands].each { |operand| @operands << CSS::Engine.new(operand).evaluate }
  self
end