Class: WordOfTheDay::Adapter::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/rodbot/plugins/word_of_the_day/lib/adapters/base.rb

Direct Known Subclasses

MerriamWebster, Transparent

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(language) ⇒ Base

Returns a new instance of Base.



10
11
12
# File 'lib/rodbot/plugins/word_of_the_day/lib/adapters/base.rb', line 10

def initialize(language)
  @language = language.downcase
end

Instance Attribute Details

#languageObject (readonly)

Returns the value of attribute language.



8
9
10
# File 'lib/rodbot/plugins/word_of_the_day/lib/adapters/base.rb', line 8

def language
  @language
end

Instance Method Details

#messageObject



14
15
16
17
18
19
20
# File 'lib/rodbot/plugins/word_of_the_day/lib/adapters/base.rb', line 14

def message
  if word
    "[#{word}](#{url}) (#{language.capitalize})"
  else
    "~~#{language.capitalize}~~"
  end
end