Skip to content

Instantly share code, notes, and snippets.

@zakwilson
Created November 9, 2009 16:45
Show Gist options
  • Save zakwilson/230080 to your computer and use it in GitHub Desktop.
Save zakwilson/230080 to your computer and use it in GitHub Desktop.
def build_conditions
conditions = []
def condition(cond, &f)
if block_given?
conditions.concat yield(cond)
else
conditions.concat lambda {|c| {c => params{c}}}.call
end
end
condition("address") do |addr|
["adddress like ?", addr]
end
conditions
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment