Class: TelegramMeetupBot::Commands::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/telegram_meetup_bot/commands/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message) ⇒ Base

Returns a new instance of Base.



6
7
8
# File 'lib/telegram_meetup_bot/commands/base.rb', line 6

def initialize(message)
  @message = message
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



4
5
6
# File 'lib/telegram_meetup_bot/commands/base.rb', line 4

def message
  @message
end

Instance Method Details

#commandObject



14
15
16
17
18
19
20
# File 'lib/telegram_meetup_bot/commands/base.rb', line 14

def command
  @command ||= if COMMANDS.include?(message.command)
    message.command
  else
    DEFAULT_COMMAND
  end
end

#execObject



10
11
12
# File 'lib/telegram_meetup_bot/commands/base.rb', line 10

def exec
  fail NotImplementedError, 'This method should be overriden'
end