eval_inspect.rb

lib/sequel/extensions/eval_inspect.rb
Last Update: 2017-02-10 16:17:29 -0800

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

Related module: Sequel::EvalInspect