Sha256: 51faf50c18539dfaf50194eb210f0e241e239f9414a3f4f61db4f876c0a551ba

Contents?: true

Size: 651 Bytes

Versions: 7

Compression:

Stored size: 651 Bytes

Contents

require "yaml"

module SCSSBeautifier
  class Config

    def initialize(config_location)
      @config = parse_config(config_location)
    end

    def parse_config(config_location)
      YAML.load(File.read(config_location))
    end

    def formatters
      enabled_formatters = []
      @config["formatters"].each do |formatter, options|
        if options["enabled"]
          klass = SCSSBeautifier::Formatters.const_get(formatter.split("_").map(&:capitalize).join)
          enabled_formatters << klass.new(options)
        end
      end
      enabled_formatters
    end

    def tab_style
      @config["tab_style"] || "  "
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
scss_beautifier-0.1.18 lib/scss_beautifier/config.rb
scss_beautifier-0.1.17 lib/scss_beautifier/config.rb
scss_beautifier-0.1.16 lib/scss_beautifier/config.rb
scss_beautifier-0.1.15 lib/scss_beautifier/config.rb
scss_beautifier-0.1.14 lib/scss_beautifier/config.rb
scss_beautifier-0.1.13 lib/scss_beautifier/config.rb
scss_beautifier-0.1.12 lib/scss_beautifier/config.rb