Last active
August 29, 2015 14:16
-
-
Save tit/015da6835188e9179026 to your computer and use it in GitHub Desktop.
Typograf
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
# encoding: utf-8 | |
require 'unirest' | |
class String | |
def typograf | |
api_uri = 'http://www.typograf.ru/webservice/' | |
begin | |
response = Unirest.post api_uri, parameters: {text: self} | |
response.body | |
rescue | |
self | |
end | |
end | |
end | |
# Use Typograf from CLI | |
if __FILE__ == $0 | |
if ARGV[0].nil? | |
puts 'usage: typograf text' | |
puts 'example: typograf "foo - bar"' | |
else | |
puts ARGV[0].typograf | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment