Module: Sass::Logger::LogLevel::ClassMethods
- Defined in:
- .ruby-sass/lib/sass/logger/log_level.rb
Instance Attribute Summary (collapse)
Instance Method Summary (collapse)
- #define_logger(name, options = {}) ⇒ Object
- #inherited(subclass) ⇒ Object
- #log_level(name, options = {}) ⇒ Object
- #log_level?(level, min_level) ⇒ Boolean
Instance Attribute Details
#log_levels ⇒ Object
15 16 17 |
# File '.ruby-sass/lib/sass/logger/log_level.rb', line 15 def log_levels @log_levels ||= {} end |
Instance Method Details
#define_logger(name, options = {}) ⇒ Object
35 36 37 38 39 40 41 |
# File '.ruby-sass/lib/sass/logger/log_level.rb', line 35 def define_logger(name, = {}) class_eval <<-RUBY, __FILE__, __LINE__ + 1 def #{name}(message) #{.fetch(:to, :log)}(#{name.inspect}, message) end RUBY end |
#inherited(subclass) ⇒ Object
9 10 11 |
# File '.ruby-sass/lib/sass/logger/log_level.rb', line 9 def inherited(subclass) subclass.log_levels = subclass.superclass.log_levels.dup end |
#log_level(name, options = {}) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File '.ruby-sass/lib/sass/logger/log_level.rb', line 23 def log_level(name, = {}) if [: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 |
#log_level?(level, min_level) ⇒ Boolean
19 20 21 |
# File '.ruby-sass/lib/sass/logger/log_level.rb', line 19 def log_level?(level, min_level) log_levels[level] >= log_levels[min_level] end |