Class: Pingilish::Farsi

Inherits:
String
  • Object
show all
Defined in:
lib/pingilish.rb

Constant Summary collapse

TO_FARSI_SERVICE_URL =
"http://www.behnevis.com/php/convert.php"
TO_FARSI_QUERY_STRING =
'farsi'

Instance Method Summary collapse

Constructor Details

#initialize(text) ⇒ Farsi

Returns a new instance of Farsi.



86
87
88
# File 'lib/pingilish.rb', line 86

def initialize(text)
  @text = text
end

Instance Method Details

#to_farsiObject



90
91
92
93
94
# File 'lib/pingilish.rb', line 90

def to_farsi
  Net::HTTP.post_form(URI.parse(TO_FARSI_SERVICE_URL), {TO_FARSI_QUERY_STRING => @text.downcase }).body
  # TODO: save the files in yaml
  # TODO: verify that it's persian
end