Sha256: 62c1ea630fed24d40653ed61f2d3d5fae8974209b5652dbde554e01324b6c6fc
Contents?: true
Size: 1.04 KB
Versions: 2
Compression:
Stored size: 1.04 KB
Contents
# frozen_string_literal: true require 'eac_ruby_utils/patches/object/if_present' require 'pp' class Object def compact_debug(*methods_names) methods_names.each do |method_name| send(method_name).print_debug(label: method_name) end end def pretty_debug(options = {}) print_debug_options(options) $stderr.write(pretty_inspect) self end def print_debug(options = {}) print_debug_options(options) $stderr.write("#{to_debug}\n") self end def print_debug_label(label) $stderr.write("#{label}: ") end def print_debug_options(options) options[:title].if_present { |v| print_debug_title(v) } options[:label].if_present { |v| print_debug_label(v) } end def print_debug_title(title) char = '=' $stderr.write("#{char * (4 + title.length)}\n") $stderr.write("#{char} #{title} #{char}\n") $stderr.write("#{char * (4 + title.length)}\n") end def to_debug "|#{::Object.instance_method(:to_s).bind(self).call}|#{self}|" end def raise_debug raise to_debug end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
eac_ruby_utils-0.121.0 | lib/eac_ruby_utils/patches/object/debug.rb |
eac_ruby_utils-0.120.0 | lib/eac_ruby_utils/patches/object/debug.rb |