mirror of
https://github.com/rest-client/rest-client.git
synced 2022-11-09 13:49:40 -05:00
use space instead of tab
This commit is contained in:
parent
41e254e6c0
commit
9e05961278
1 changed files with 38 additions and 38 deletions
|
@ -13,7 +13,7 @@ def usage(why = nil)
|
|||
exit(1)
|
||||
end
|
||||
|
||||
if %w(get put post delete).include? ARGV.first
|
||||
if %w( get put post delete ).include? ARGV.first
|
||||
@verb = ARGV.shift
|
||||
else
|
||||
@verb = nil
|
||||
|
@ -26,7 +26,7 @@ config = YAML.load(File.read(ENV['HOME'] + "/.restclient")) rescue {}
|
|||
@url, @username, @password = if c = config[@url]
|
||||
[c['url'], c['username'], c['password']]
|
||||
else
|
||||
[@url, *ARGV]
|
||||
[@url, * ARGV]
|
||||
end
|
||||
|
||||
usage("invalid url '#{@url}") unless @url =~ /^https?/
|
||||
|
@ -40,7 +40,7 @@ r # force rc to load
|
|||
|
||||
if @verb
|
||||
begin
|
||||
if %w(put post).include? @verb
|
||||
if %w( put post ).include? @verb
|
||||
puts r.send(@verb, STDIN.read)
|
||||
else
|
||||
puts r.send(@verb)
|
||||
|
@ -52,18 +52,18 @@ if @verb
|
|||
end
|
||||
end
|
||||
|
||||
%w(get post put delete).each do |m|
|
||||
%w( get post put delete ).each do |m|
|
||||
eval <<-end_eval
|
||||
def #{m}(path, *args, &b)
|
||||
r[path].#{m}(*args, &b)
|
||||
def #{m} (path, *args, &b)
|
||||
r[path]. #{m} (*args, &b)
|
||||
end
|
||||
end_eval
|
||||
end
|
||||
|
||||
def method_missing(s, *args, &b)
|
||||
def method_missing(s, * args, & b)
|
||||
super unless r.respond_to?(s)
|
||||
begin
|
||||
r.send(s, *args, &b)
|
||||
r.send(s, * args, & b)
|
||||
rescue RestClient::RequestFailed => e
|
||||
print STDERR, e.response.body
|
||||
raise e
|
||||
|
@ -77,7 +77,7 @@ if File.exists? ".irbrc"
|
|||
ENV['IRBRC'] = ".irbrc"
|
||||
end
|
||||
|
||||
if File.exists?( File.expand_path(rcfile = "~/.restclientrc") )
|
||||
if File.exists?(File.expand_path(rcfile = "~/.restclientrc"))
|
||||
load(rcfile)
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue