Class: TelosLWCP::Command::Outgoing

Inherits:
Object
  • Object
show all
Defined in:
lib/telos_lwcp/command.rb

Instance Method Summary collapse

Constructor Details

#initialize(command, object, arguments) ⇒ Outgoing

Returns a new instance of Outgoing.



4
5
6
7
8
# File 'lib/telos_lwcp/command.rb', line 4

def initialize(command, object, arguments)
  @command = command
  @object = object
  @arguments = arguments
end

Instance Method Details

#arguments_strObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/telos_lwcp/command.rb', line 14

def arguments_str
  @arguments.map do |argument, value|
    rv = case value
         when TrueClass
           'TRUE'
         when FalseClass
           'FALSE'
         when Integer
           value
         when String
           "\"#{value}\""
         end
    "#{argument}=#{rv}"
  end.join(', ')
end

#to_sObject



10
11
12
# File 'lib/telos_lwcp/command.rb', line 10

def to_s
  "#{@command} #{@object} #{arguments_str}\n"
end