Class: GoogleFish
- Inherits:
-
Object
- Object
- GoogleFish
- Defined in:
- lib/google_fish.rb
Defined Under Namespace
Classes: Request
Instance Attribute Summary collapse
-
#format ⇒ Object
Returns the value of attribute format.
-
#key ⇒ Object
Returns the value of attribute key.
-
#q ⇒ Object
Returns the value of attribute q.
-
#source ⇒ Object
Returns the value of attribute source.
-
#target ⇒ Object
Returns the value of attribute target.
-
#translated_text ⇒ Object
Returns the value of attribute translated_text.
Instance Method Summary collapse
-
#initialize(key) ⇒ GoogleFish
constructor
A new instance of GoogleFish.
- #translate(source, target, q, options = {}) ⇒ Object
Constructor Details
#initialize(key) ⇒ GoogleFish
Returns a new instance of GoogleFish.
4 5 6 7 |
# File 'lib/google_fish.rb', line 4 def initialize(key) @key = key @format = :text end |
Instance Attribute Details
#format ⇒ Object
Returns the value of attribute format.
2 3 4 |
# File 'lib/google_fish.rb', line 2 def format @format end |
#key ⇒ Object
Returns the value of attribute key.
2 3 4 |
# File 'lib/google_fish.rb', line 2 def key @key end |
#q ⇒ Object
Returns the value of attribute q.
2 3 4 |
# File 'lib/google_fish.rb', line 2 def q @q end |
#source ⇒ Object
Returns the value of attribute source.
2 3 4 |
# File 'lib/google_fish.rb', line 2 def source @source end |
#target ⇒ Object
Returns the value of attribute target.
2 3 4 |
# File 'lib/google_fish.rb', line 2 def target @target end |
#translated_text ⇒ Object
Returns the value of attribute translated_text.
2 3 4 |
# File 'lib/google_fish.rb', line 2 def translated_text @translated_text end |
Instance Method Details
#translate(source, target, q, options = {}) ⇒ Object
9 10 11 12 13 |
# File 'lib/google_fish.rb', line 9 def translate(source, target, q, ={}) @format = :html if [:html] @source, @target, @q = source, target, q @translated_text = request_translation end |