Class: Smartdict::Translation
- Inherits:
-
Object
- Object
- Smartdict::Translation
- Defined in:
- lib/smartdict/translation.rb
Instance Attribute Summary collapse
-
#driver ⇒ Object
Returns the value of attribute driver.
-
#from_lang ⇒ Object
Returns the value of attribute from_lang.
-
#to_lang ⇒ Object
Returns the value of attribute to_lang.
-
#transcription ⇒ Object
Returns the value of attribute transcription.
-
#translated ⇒ Object
Returns the value of attribute translated.
-
#word ⇒ Object
Returns the value of attribute word.
Instance Method Summary collapse
- #[](word_class) ⇒ Object
-
#initialize(attrs) ⇒ Translation
constructor
A new instance of Translation.
Constructor Details
#initialize(attrs) ⇒ Translation
Returns a new instance of Translation.
9 10 11 12 13 14 |
# File 'lib/smartdict/translation.rb', line 9 def initialize(attrs) @translated = {} attrs.each do |attr, value| self.send("#{attr}=", value) end end |
Instance Attribute Details
#driver ⇒ Object
Returns the value of attribute driver.
2 3 4 |
# File 'lib/smartdict/translation.rb', line 2 def driver @driver end |
#from_lang ⇒ Object
Returns the value of attribute from_lang.
2 3 4 |
# File 'lib/smartdict/translation.rb', line 2 def from_lang @from_lang end |
#to_lang ⇒ Object
Returns the value of attribute to_lang.
2 3 4 |
# File 'lib/smartdict/translation.rb', line 2 def to_lang @to_lang end |
#transcription ⇒ Object
Returns the value of attribute transcription.
2 3 4 |
# File 'lib/smartdict/translation.rb', line 2 def transcription @transcription end |
#translated ⇒ Object
Returns the value of attribute translated.
2 3 4 |
# File 'lib/smartdict/translation.rb', line 2 def translated @translated end |
#word ⇒ Object
Returns the value of attribute word.
2 3 4 |
# File 'lib/smartdict/translation.rb', line 2 def word @word end |
Instance Method Details
#[](word_class) ⇒ Object
16 17 18 |
# File 'lib/smartdict/translation.rb', line 16 def [](word_class) @translated[word_class.to_s] ||= [] end |