Sha256: f97259fab986e584c720121ee8187a1e7a0ca1e2cfd76f6cdcfa866e3382e883

Contents?: true

Size: 970 Bytes

Versions: 4

Compression:

Stored size: 970 Bytes

Contents

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

class StyleStats
  def self.configure(&block)
    yield(configuration)
  end

  def self.configuration
    @_configuration ||= StyleStats::Configuration.new
  end

  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))
    end
  end

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

  private
  def options
    {
      format:   @options[:format],
      template: @options[:template]
    }
  end
end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
style_stats-0.4.2 lib/style_stats.rb
style_stats-0.4.1 lib/style_stats.rb
style_stats-0.4.0 lib/style_stats.rb
style_stats-0.3.0 lib/style_stats.rb