Created
November 9, 2009 16:45
-
-
Save zakwilson/230080 to your computer and use it in GitHub Desktop.
This file contains 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
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