Browse files

Merge pull request #4 from GunioRobot/clean

Hi! I cleaned up your code for you!
  • Loading branch information...
2 parents 1933f84 + a2b7dcd commit 871fb11ce98f1fc82adff6f544619936d12c1cea @antono committed Dec 21, 2011
Showing with 7 additions and 7 deletions.
  1. +7 −7 lib/pastie.rb
View
14 lib/pastie.rb
@@ -26,13 +26,13 @@ def self.menus
end
end
end
- end
+ end
class PasteSelection < EditTabCommand
- def execute
+ def execute
text = doc.selection? ? doc.selected_text : doc.to_s
- resp = paste_text(text)
-
+ resp = paste_text(text)
+
# Copy url to clipboard or show message
if(storage['auto_copy_to_clipboard'] && resp)
Redcar.app.clipboard << resp
@@ -50,11 +50,11 @@ def storage
@storage.set_default('auto_copy_to_clipboard', 'true')
@storage
end
-
+
def paste_text(text)
uri = URI.parse('http://gist.github.com/api/v1/xml/new')
req = Net::HTTP::Post.new(uri.path)
-
+
# In case of auth fail just post as anonymous
req.basic_auth(storage['login'] + '/token', storage['token'])
req.set_form_data({ "files[#{tab.title}]" => text })
@@ -66,7 +66,7 @@ def paste_text(text)
end
end
end
-
+
class SelectService < Redcar::Command
def execute

0 comments on commit 871fb11

Please sign in to comment.