eval_inspect.rb

Path: lib/sequel/extensions/eval_inspect.rb
Last Update: Wed May 15 17:48:08 +0000 2013

The eval_inspect extension changes inspect for Sequel::SQL::Expression subclasses to return a string suitable for ruby‘s eval, such that

  eval(obj.inspect) == obj

is true. The above code is true for most of ruby‘s simple classes such as String, Integer, Float, and Symbol, but it‘s not true for classes such as Time, Date, and BigDecimal. Sequel attempts to handle situations where instances of these classes are a component of a Sequel expression.

To load the extension:

  Sequel.extension :eval_inspect

[Validate]