Module: Glimmer::Config
- Defined in:
- lib/glimmer/config.rb
Constant Summary collapse
- LOOP_MAX_COUNT_DEFAULT =
100
- REGEX_METHODS_EXCLUDED =
/^(to_|\[|load_iseq)/
Class Attribute Summary collapse
-
.log_excluded_keywords ⇒ Object
(also: log_excluded_keywords?)
Returns the value of attribute log_excluded_keywords.
- .loop_max_count ⇒ Object
Class Method Summary collapse
- .excluded_keyword_checkers ⇒ Object
- .excluded_keyword_checkers=(checkers) ⇒ Object
-
.logger ⇒ Object
Returns Glimmer logger (standard Ruby logger).
- .logger=(custom_logger) ⇒ Object
- .reset_excluded_keyword_checkers! ⇒ Object
- .reset_logger! ⇒ Object
Class Attribute Details
.log_excluded_keywords ⇒ Object Also known as: log_excluded_keywords?
Returns the value of attribute log_excluded_keywords.
29 30 31 |
# File 'lib/glimmer/config.rb', line 29 def log_excluded_keywords @log_excluded_keywords end |
.loop_max_count ⇒ Object
44 45 46 |
# File 'lib/glimmer/config.rb', line 44 def loop_max_count @loop_max_count ||= LOOP_MAX_COUNT_DEFAULT end |
Class Method Details
.excluded_keyword_checkers ⇒ Object
32 33 34 |
# File 'lib/glimmer/config.rb', line 32 def excluded_keyword_checkers @excluded_keyword_checkers ||= reset_excluded_keyword_checkers! end |
.excluded_keyword_checkers=(checkers) ⇒ Object
36 37 38 |
# File 'lib/glimmer/config.rb', line 36 def excluded_keyword_checkers=(checkers) @excluded_keyword_checkers = checkers end |
.logger ⇒ Object
Returns Glimmer logger (standard Ruby logger)
49 50 51 52 |
# File 'lib/glimmer/config.rb', line 49 def logger reset_logger! unless defined? @@logger @@logger end |
.logger=(custom_logger) ⇒ Object
54 55 56 |
# File 'lib/glimmer/config.rb', line 54 def logger=(custom_logger) @@logger = custom_logger end |
.reset_excluded_keyword_checkers! ⇒ Object
40 41 42 |
# File 'lib/glimmer/config.rb', line 40 def reset_excluded_keyword_checkers! @excluded_keyword_checkers = [ lambda { |method_symbol, *args| method_symbol.to_s.match(REGEX_METHODS_EXCLUDED) } ] end |
.reset_logger! ⇒ Object
58 59 60 61 62 63 64 65 66 67 |
# File 'lib/glimmer/config.rb', line 58 def reset_logger! self.logger = Logger.new($stdout).tap do |logger| logger.level = Logger::ERROR begin logger.level = ENV['GLIMMER_LOGGER_LEVEL'].strip.downcase unless ENV['GLIMMER_LOGGER_LEVEL'].to_s.strip.empty? rescue => e puts e. end end end |