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 63 def inspect 64 # Assume by default that the object can be recreated by calling 65 # self.class.new with any attr_reader values defined on the class, 66 # in the order they were defined. 67 klass = self.class 68 args = inspect_args.map do |arg| 69 if arg.is_a?(String) && arg =~ /\A\*/ 70 # Special case string arguments starting with *, indicating that 71 # they should return an array to be splatted as the remaining arguments. 72 # Allow calling private methods to get inspect output. 73 send(arg.sub('*', '')).map{|a| Sequel.eval_inspect(a)}.join(', ') 74 else 75 # Allow calling private methods to get inspect output. 76 Sequel.eval_inspect(send(arg)) 77 end 78 end 79 "#{klass}.#{inspect_new_method}(#{args.join(', ')})" 80 end