Top Level Namespace
Defined Under Namespace
Classes: Yfinrb
Instance Method Summary collapse
-
#attributes(obj) ⇒ Object
self.logger = Logger.new(STDOUT) self.logger.level = Logger::WARN end.
- #enable_debug_mode ⇒ Object
- #get_yf_logger ⇒ Object
- #print_once(msg) ⇒ Object
- #setup_debug_formatting ⇒ Object
Instance Method Details
#attributes(obj) ⇒ Object
self.logger = Logger.new(STDOUT)
self.logger.level = Logger::WARN
end
324 325 326 327 328 329 330 331 332 |
# File 'lib/yfinrb/utils.rb', line 324 def attributes(obj) disallowed_names = Set.new(obj.class.instance_methods(false).map(&:to_s)) obj.instance_variables.each_with_object({}) do |var, h| name = var.to_s[1..] next if name.start_with?('_') || disallowed_names.include?(name) h[name] = obj.instance_variable_get(var) end end |
#enable_debug_mode ⇒ Object
351 352 353 354 |
# File 'lib/yfinrb/utils.rb', line 351 def enable_debug_mode Rails.logger.level = Logger::DEBUG setup_debug_formatting end |
#get_yf_logger ⇒ Object
338 339 340 341 |
# File 'lib/yfinrb/utils.rb', line 338 def get_yf_logger # Yfin.logger Rails.logger end |
#print_once(msg) ⇒ Object
334 335 336 |
# File 'lib/yfinrb/utils.rb', line 334 def print_once(msg) puts msg end |
#setup_debug_formatting ⇒ Object
343 344 345 346 347 348 349 |
# File 'lib/yfinrb/utils.rb', line 343 def setup_debug_formatting logger = get_yf_logger return unless logger.level == Logger::DEBUG logger.formatter = MultiLineFormatter.new('%(levelname)-8s %(message)s') end |