Skip to content

Instantly share code, notes, and snippets.

@laurens
Created August 11, 2012 00:55
Show Gist options
  • Save laurens/3319579 to your computer and use it in GitHub Desktop.
Save laurens/3319579 to your computer and use it in GitHub Desktop.
1.9.2p290 :007 > query = "foo"
=> "foo"
1.9.2p290 :008 > keyword_query = query and query.match(/\w/) and "#{query} AND "
=> "foo AND "
1.9.2p290 :009 > keyword_query
=> "foo"
1.9.2p290 :010 > full_query = "#{keyword_query}is_active:(true)"
=> "foois_active:(true)"
1.9.2p290 :011 >
1.9.2p290 :005 > keyword_query = (query and query.match(/\w/) and "#{query} AND ")
=> "foo AND "
1.9.2p290 :006 > full_query = "#{keyword_query}is_active:(true)"
=> "foo AND is_active:(true)"
1.9.2p290 :007 >
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment