Class: GoogleTranslateScraper::Models::Translator
- Inherits:
-
Object
- Object
- GoogleTranslateScraper::Models::Translator
- Defined in:
- lib/google_translate_scraper/models/translator.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
Returns the value of attribute response.
-
#search_text ⇒ Object
Returns the value of attribute search_text.
-
#source_language ⇒ Object
Returns the value of attribute source_language.
-
#target_language ⇒ Object
Returns the value of attribute target_language.
Instance Method Summary collapse
-
#initialize(arguments) ⇒ Translator
constructor
A new instance of Translator.
- #required_variables ⇒ Object
- #translate ⇒ Object
Constructor Details
#initialize(arguments) ⇒ Translator
Returns a new instance of Translator.
10 11 12 13 14 15 |
# File 'lib/google_translate_scraper/models/translator.rb', line 10 def initialize(arguments) arguments.each do |key, value| instance_variable_set("@#{key}", value) end @response = Response.new end |
Instance Attribute Details
#response ⇒ Object
Returns the value of attribute response.
8 9 10 |
# File 'lib/google_translate_scraper/models/translator.rb', line 8 def response @response end |
#search_text ⇒ Object
Returns the value of attribute search_text.
8 9 10 |
# File 'lib/google_translate_scraper/models/translator.rb', line 8 def search_text @search_text end |
#source_language ⇒ Object
Returns the value of attribute source_language.
8 9 10 |
# File 'lib/google_translate_scraper/models/translator.rb', line 8 def source_language @source_language end |
#target_language ⇒ Object
Returns the value of attribute target_language.
8 9 10 |
# File 'lib/google_translate_scraper/models/translator.rb', line 8 def target_language @target_language end |
Instance Method Details
#required_variables ⇒ Object
24 25 26 |
# File 'lib/google_translate_scraper/models/translator.rb', line 24 def required_variables %w[source_language target_language search_text] end |
#translate ⇒ Object
17 18 19 20 21 22 |
# File 'lib/google_translate_scraper/models/translator.rb', line 17 def translate if valid? populate_translations end response end |