Skip to content

Instantly share code, notes, and snippets.

@joeljunstrom
Created November 22, 2011 11:30
Show Gist options
  • Save joeljunstrom/1385462 to your computer and use it in GitHub Desktop.
Save joeljunstrom/1385462 to your computer and use it in GitHub Desktop.
def http_methods
methods = Array.new
methods << 'GET' if self.http_get
methods << 'POST' if self.http_post
methods << 'PUT' if self.http_put
methods << 'DELETE' if self.http_delete
methods << 'HEAD' if self.http_head
methods
end
def http_methods
[].tap do |methods|
methods << 'GET' if self.http_get?
methods << 'POST' if self.http_post?
methods << 'PUT' if self.http_put?
methods << 'DELETE' if self.http_delete?
methods << 'HEAD' if self.http_head?
end
end
def http_methods
%w(GET POST PUT DELETE HEAD).find_all { |m| self.public_send("http_#{m.downcase}?") }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment