Sha256: 6cbf5fb33f6a67c6d2e150a50aaeadfca3c82ee118a47002fd6b6c4dd25d8ca8
Contents?: true
Size: 1.38 KB
Versions: 2
Compression:
Stored size: 1.38 KB
Contents
class LocalRaiseError < StandardError end class Object # raise object def r what opath = what.class.ancestors out = opath.join("\n> ") data = what.is_a?(Hash) ? JSON.pretty_generate(what) : what.ai(plain:true) out = [data, out, ''].join("\n\n-\n\n") # unique_methods = what.methods - what.class.ancestors[0].instance_methods # raise unique_methods raise LocalRaiseError.new out end # better console log dump def rr what ap ['--- START (%s) ---' % what.class, what, '--- END ---'] end # unique methods for object # includes methods from modules def rm object dump = [] dump.push ['Class', object.class] instance_unique = object.methods - object.class.ancestors[0].instance_methods class_unique = object.methods object.class.ancestors.drop(1).each do |_| class_unique -= _.instance_methods if _.class != Module dump.push ['Parent Class', _] break end end dump.push ['Instance uniqe', instance_unique.sort] if instance_unique[0] dump.push ['Uniqe from parent', class_unique.sort] dump.push ['Uniqe from parent simple', object.class.instance_methods(false)] r dump end def rr! what print "\e[H\e[2J\e[3J" # clear osx screen :) rr what end def instance_variables_hash Hash[instance_variables.map { |name| [name, instance_variable_get(name)] } ] end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
lux-fw-0.2.3 | ./lib/overload/r.rb |
lux-fw-0.2.1 | ./lib/overload/r.rb |