Class: Smartdict::Translation

Inherits:
Object
  • Object
show all
Defined in:
lib/smartdict/translation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#driverObject

Returns the value of attribute driver.



2
3
4
# File 'lib/smartdict/translation.rb', line 2

def driver
  @driver
end

#from_langObject

Returns the value of attribute from_lang.



2
3
4
# File 'lib/smartdict/translation.rb', line 2

def from_lang
  @from_lang
end

#to_langObject

Returns the value of attribute to_lang.



2
3
4
# File 'lib/smartdict/translation.rb', line 2

def to_lang
  @to_lang
end

#transcriptionObject

Returns the value of attribute transcription.



2
3
4
# File 'lib/smartdict/translation.rb', line 2

def transcription
  @transcription
end

#translatedObject

Returns the value of attribute translated.



2
3
4
# File 'lib/smartdict/translation.rb', line 2

def translated
  @translated
end

#wordObject

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