Class: Leonidas::Commands::Command
- Inherits:
-
Object
- Object
- Leonidas::Commands::Command
- Defined in:
- lib/leonidas/commands/command.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Instance Method Summary collapse
-
#initialize(name, data, timestamp, connection) ⇒ Command
constructor
A new instance of Command.
- #to_hash ⇒ Object
Constructor Details
#initialize(name, data, timestamp, connection) ⇒ Command
Returns a new instance of Command.
8 9 10 11 12 13 14 15 |
# File 'lib/leonidas/commands/command.rb', line 8 def initialize(name, data, , connection) @name = name @data = data @timestamp = raise TypeError, "Argument must be a Leonidas::App::Connection" unless connection.is_a? ::Leonidas::App::Connection @connection = connection end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
6 7 8 |
# File 'lib/leonidas/commands/command.rb', line 6 def connection @connection end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
6 7 8 |
# File 'lib/leonidas/commands/command.rb', line 6 def data @data end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/leonidas/commands/command.rb', line 6 def name @name end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
6 7 8 |
# File 'lib/leonidas/commands/command.rb', line 6 def @timestamp end |
Instance Method Details
#to_hash ⇒ Object
17 18 19 |
# File 'lib/leonidas/commands/command.rb', line 17 def to_hash { name: @name, data: @data, timestamp: @timestamp, connection: @connection.id } end |