Public Instance methods
inspect()
Attempt to produce a string suitable for eval, such that:
eval(obj.inspect) == obj
[show source]
# File lib/sequel/extensions/eval_inspect.rb 65 def inspect 66 # Assume by default that the object can be recreated by calling 67 # self.class.new with any attr_reader values defined on the class, 68 # in the order they were defined. 69 klass = self.class 70 args = inspect_args.map do |arg| 71 if arg.is_a?(String) && arg.start_with?('*') 72 # Special case string arguments starting with *, indicating that 73 # they should return an array to be splatted as the remaining arguments. 74 # Allow calling private methods to get inspect output. 75 send(arg.sub('*', '')).map{|a| Sequel.eval_inspect(a)}.join(', ') 76 else 77 # Allow calling private methods to get inspect output. 78 Sequel.eval_inspect(send(arg)) 79 end 80 end 81 "#{klass}.#{inspect_new_method}(#{args.join(', ')})" 82 end