lib/debug_helper.rb in debug_helper-1.6.0 vs lib/debug_helper.rb in debug_helper-1.7.0
- old
+ new
@@ -1,5 +1,6 @@
+require 'set'
require 'yaml'
require 'debug_helper/version'
class DebugHelper
@@ -43,14 +44,15 @@
s = case
when obj.kind_of?(Array)
show_array(obj, message, info)
when obj.kind_of?(Hash)
show_hash(obj, message, info)
+ when obj.kind_of?(Set)
+ show_array(obj, message, info)
when obj.kind_of?(Struct)
show_struct(obj, message, info)
# when obj.kind_of?(Range)
- # when obj.kind_of?(Set)
else
show_object(obj, message, info)
end
object_ids.pop
end
@@ -87,11 +89,11 @@
def show_object(obj, message, info)
methods = methods_for_object(obj)
if methods.nil?
message_info = message.nil? ? '' : " (message='#{message}')"
- "#{obj.class.name}#{message_info} #{obj}"
+ "#{obj.class.name}#{message_info} #{obj.inspect}"
else
content = {}
attrs = {:message => message}
methods[:instance].each do |instance_method|
value = obj.send(instance_method)
@@ -150,14 +152,26 @@
methods = case
when obj.kind_of?(File)
{
# The instance forms of some of these require the file to be open.
:class => {
- :path => [obj.path],
+ :absolute_path => [obj.path],
:atime => [obj.path],
:ctime => [obj.path],
+ :executable? => [obj.path],
+ :exist? => [obj.path],
+ :ftype => [obj.path],
:mtime => [obj.path],
+ :path => [obj.path],
+ :pipe? => [obj.path],
+ :readable? => [obj.path],
+ :realpath => [obj.path],
+ :setgid? => [obj.path],
+ :setuid? => [obj.path],
:size => [obj.path],
+ :socket? => [obj.path],
+ :symlink? => [obj.path],
+ :writable? => [obj.path],
},
:instance => [],
}
when obj.kind_of?(String)
{