gems.sass-3.2.9.lib.sass.logger.log_level.rb Maven / Gradle / Ivy
Go to download
Sass makes CSS fun again. Sass is an extension of CSS3, adding nested rules, variables, mixins, selector
inheritance, and more. It's translated to well-formatted, standard CSS using the command line tool or a
web-framework plugin.
This is a repackaged GEM in a JAR format of the sass-lang.gem package. The sass-gems package version
follows the sass-lang.gem versions located http://rubyforge.org/frs/?group_id=9702. Simply change
the version of this package to download and repackage the same GEM version.
The newest version!
module Sass
module Logger
module LogLevel
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def inherited(subclass)
subclass.log_levels = subclass.superclass.log_levels.dup
end
def log_levels
@log_levels ||= {}
end
def log_levels=(levels)
@log_levels = levels
end
def log_level?(level, min_level)
log_levels[level] >= log_levels[min_level]
end
def log_level(name, options = {})
if options[:prepend]
level = log_levels.values.min
level = level.nil? ? 0 : level - 1
else
level = log_levels.values.max
level = level.nil? ? 0 : level + 1
end
log_levels.update(name => level)
define_logger(name)
end
def define_logger(name, options = {})
class_eval <<-RUBY, __FILE__, __LINE__ + 1
def #{name}(message)
#{options.fetch(:to, :log)}(#{name.inspect}, message)
end
RUBY
end
end
end
end
end