eval_inspect.rb

lib/sequel/extensions/eval_inspect.rb
Last Update: 2020-12-04 13:44:07 -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