Sha256: 63f94ccf25184769a62f7ce1cdb5239cc666f562c0036081c028882879e91eef

Contents?: true

Size: 841 Bytes

Versions: 1

Compression:

Stored size: 841 Bytes

Contents

require 'erb'
require 'oga'
require 'open-uri'
require 'css_parser'
require 'json'
require 'command_line_reporter'

class StyleStats
  def initialize(paths, options = {})
    paths = [paths] unless paths.is_a?(Array)

    @options = options

    files = paths.map do |path|
      PathParser.new(path).files
    end.flatten

    @css = files.inject(Css.new) do |css, file|
      css.merge!(Css.new(file, css_options))
    end
  end

  def render
    Template.new(@css, template_options).render
  end

  private
  def css_options
    {
      user_agent: @options[:user_agent]
    }
  end

  def template_options
    {
      format: @options[:format]
    }
  end
end

require 'style_stats/version'
require 'style_stats/path_parser'
require 'style_stats/css'
require 'style_stats/template'
require 'style_stats/errors'
require 'style_stats/cli'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
style_stats-0.1.0 lib/style_stats.rb