Class: RespondableTelegram

Inherits:
Telegram show all
Defined in:
lib/telegrams/respondable_telegram.rb

Direct Known Subclasses

DirectCommand, SystemCommand

Instance Attribute Summary collapse

Attributes inherited from Telegram

#type

Instance Method Summary collapse

Methods inherited from Telegram

#max_size_in_bytes

Constructor Details

#initialize(require_response = true) ⇒ RespondableTelegram

Returns a new instance of RespondableTelegram.



5
6
7
8
# File 'lib/telegrams/respondable_telegram.rb', line 5

def initialize(require_response=true)
  @require_response = require_response
  @command = nil
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



4
5
6
# File 'lib/telegrams/respondable_telegram.rb', line 4

def command
  @command
end

Instance Method Details

#as_bytesObject

override



19
20
21
# File 'lib/telegrams/respondable_telegram.rb', line 19

def as_bytes
  [adjust_type_for_require_response, command]
end

#require_response=(value) ⇒ Object



14
15
16
# File 'lib/telegrams/respondable_telegram.rb', line 14

def require_response=(value)
  @require_response = value
end

#require_response?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/telegrams/respondable_telegram.rb', line 10

def require_response?
  @require_response
end