class SCSSBeautifier::Config
Constants
- DEFAULT
Public Class Methods
new(config_location)
click to toggle source
# File lib/scss_beautifier/config.rb, line 7 def initialize(config_location) @config = parse_config(config_location.to_s) end
Public Instance Methods
formatters()
click to toggle source
# File lib/scss_beautifier/config.rb, line 16 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
options()
click to toggle source
# File lib/scss_beautifier/config.rb, line 27 def options options_with_key_symbols = {} @config["options"].each do |k, v| options_with_key_symbols[:"#{k}"] = v end options_with_key_symbols end
parse_config(config_location)
click to toggle source
# File lib/scss_beautifier/config.rb, line 11 def parse_config(config_location) config_contents = read_config(config_location) YAML.load(config_contents) end
Private Instance Methods
read_config(config_location)
click to toggle source
# File lib/scss_beautifier/config.rb, line 37 def read_config(config_location) location = File.exists?(config_location) ? config_location : DEFAULT File.read(location) end