Sha256: 75ef6976aa5cb80f26961220e525c99013cff0030b131cb998e380e89a1c9f45

Contents?: true

Size: 570 Bytes

Versions: 1

Compression:

Stored size: 570 Bytes

Contents

require 'style_stats/templates/table'

class StyleStats
  class Template
    include CommandLineReporter

    def initialize(css, options = {})
      @css = css
      @options = {format: :default}
      @options.merge!(options)
    end

    def render
      case @options[:format].to_sym
      when :md, :html
        text = File.read("#{File.dirname(__FILE__)}/templates/#{@options[:format]}.erb")
        ERB.new(text, nil, '-').run(binding)
      when :json
        puts @css.analyze.to_json
      else
        Table.new(@css.analyze).run
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
style_stats-0.0.1 lib/style_stats/template.rb