Created
February 6, 2013 01:46
-
-
Save chanks/4719494 to your computer and use it in GitHub Desktop.
Quick alternate implementation for Dataset#query.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Sequel | |
class Dataset | |
class Query | |
attr_reader :dataset | |
def initialize(dataset) | |
@dataset = dataset | |
end | |
def method_missing(method, *args, &block) | |
@dataset = @dataset.send(method, *args, &block) | |
self | |
end | |
end | |
def query(&block) | |
Query.new(self).instance_eval(&block).dataset | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment