Skip to content

Instantly share code, notes, and snippets.

@murayama333
Created September 28, 2010 15:21
Show Gist options
  • Save murayama333/601185 to your computer and use it in GitHub Desktop.
Save murayama333/601185 to your computer and use it in GitHub Desktop.
class SQLBuilder
def self.method_missing(method_name, *args)
SQLBuilder.new(method_name)
end
def method_missing(method_name, *args)
@buf << method_name
self
end
def build
@buf.join(" ")
end
private
def initialize(keyword)
@buf = [keyword]
end
end
select = SQLBuilder.select
puts select.*.from.emp.build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment