On Feb 26, 1:31 pm, Jeremy Evans <[email protected]> wrote: > http://pastie.org/401414has an implementation that changes Sequel to > instance_eval the filter, select, and order blocks unless the blocks > require an argument: > > def a > 'b' > end > dataset.filter{a} # SQL: "a" > dataset.filter{|o| a} # SQL: 'b' > dataset.filter{|o| o.a} # SQL: "a" > > This would be a serious breakage to backwards compatibility, though on > a lot of queries it would make the API nicer. I like the fact that it > gives the user control to decide, though the usage is a little > obtuse. I'd like to get some comments from the community before I > decide if I want to do this.
I just added this feature to the master branch, though you need to turn it on with Sequel.virtual_row_instance_eval = true. If you don't turn it on and you use a virtual row block without a block argument, it prints a deprecation message. To implement the deprecation messages, I refactored the old deprecation code and brought it back, as it is going to be used quite a bit. To turn off the deprecation messages: Sequel::Deprecation.output = nil By default the deprecation messages include 10 lines of the backtrace. To change that: Sequel::Deprecation.backtraces = 20 # 20 lines Sequel::Deprecation.backtraces = false # no lines Sequel::Deprecation.backtraces = true # all lines Jeremy --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sequel-talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en -~----------~----~----~----~------~----~------~--~---
