Class: C3po
- Inherits:
-
Object
- Object
- C3po
- Includes:
- Client, Translator
- Defined in:
- lib/c3po.rb,
lib/c3po/client.rb,
lib/c3po/version.rb,
lib/c3po/translator.rb,
lib/c3po/translator/bing.rb,
lib/c3po/translator/google.rb,
lib/c3po/translator/result.rb,
lib/c3po/translator/configuration.rb
Defined Under Namespace
Modules: Client, Translator Classes: NoGivenProvider, NoGivenString
Constant Summary collapse
- VERSION =
"0.1.1"
Class Attribute Summary collapse
-
.base_url ⇒ Object
Returns the value of attribute base_url.
Instance Attribute Summary collapse
-
#adaptor ⇒ Object
readonly
Returns the value of attribute adaptor.
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#to_be_translated ⇒ Object
readonly
Returns the value of attribute to_be_translated.
Class Method Summary collapse
-
.configure(&block) ⇒ Object
Define a configure block.
Instance Method Summary collapse
-
#initialize(to_be_translated = nil) ⇒ C3po
constructor
Define a translator object.
Methods included from Translator
#is, #is?, #languages, #translate
Methods included from Client
Constructor Details
#initialize(to_be_translated = nil) ⇒ C3po
Define a translator object.
32 33 34 35 36 37 38 39 |
# File 'lib/c3po.rb', line 32 def initialize(to_be_translated = nil) raise NoGivenString if to_be_translated.nil? @to_be_translated = to_be_translated select_provider @base_url = self.class.base_url @result = C3po::Translator::Result.new @errors = [] end |
Class Attribute Details
.base_url ⇒ Object
Returns the value of attribute base_url.
43 44 45 |
# File 'lib/c3po.rb', line 43 def base_url @base_url end |
Instance Attribute Details
#adaptor ⇒ Object (readonly)
Returns the value of attribute adaptor.
20 21 22 |
# File 'lib/c3po.rb', line 20 def adaptor @adaptor end |
#base_url ⇒ Object (readonly)
Returns the value of attribute base_url.
20 21 22 |
# File 'lib/c3po.rb', line 20 def base_url @base_url end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
20 21 22 |
# File 'lib/c3po.rb', line 20 def errors @errors end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
20 21 22 |
# File 'lib/c3po.rb', line 20 def result @result end |
#to_be_translated ⇒ Object (readonly)
Returns the value of attribute to_be_translated.
20 21 22 |
# File 'lib/c3po.rb', line 20 def to_be_translated @to_be_translated end |
Class Method Details
.configure(&block) ⇒ Object
Define a configure block.
Delegates to C3po::Translator::Configuration
config.provider can be an Array. In this case, provider will be randomly choosen from it.
62 63 64 |
# File 'lib/c3po.rb', line 62 def configure(&block) C3po::Translator::Configuration.configure(&block) end |