Skip to content

Instantly share code, notes, and snippets.

@defndaines
Created October 16, 2014 03:35
Show Gist options
  • Save defndaines/4835ca1a8121179873b1 to your computer and use it in GitHub Desktop.
Save defndaines/4835ca1a8121179873b1 to your computer and use it in GitHub Desktop.
Using Lambdas Instead
if post
request = lambda { |p| AJAX.form_post(conn, address, p) }
else
request = lambda { |p| AJAX.get(conn, address, AJAX::CONTENT_TYPE::JSON, p) }
end
response = request.(parameters)
# ...
while # ...
# Change parameters
response = request.(parameters)
# ...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment