Created
November 22, 2011 11:30
-
-
Save joeljunstrom/1385462 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 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