Skip to content

Instantly share code, notes, and snippets.

@chanks
Created February 6, 2013 01:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chanks/4719494 to your computer and use it in GitHub Desktop.
Save chanks/4719494 to your computer and use it in GitHub Desktop.
Quick alternate implementation for Dataset#query.
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