Module: Simultaneous::Command

Defined in:
lib/simultaneous/command.rb,
lib/simultaneous/command/fire.rb,
lib/simultaneous/command/kill.rb,
lib/simultaneous/command/set_pid.rb,
lib/simultaneous/command/client_event.rb,
lib/simultaneous/command/task_complete.rb

Defined Under Namespace

Classes: ClientEvent, CommandBase, Fire, Kill, SetPid, TaskComplete

Constant Summary collapse

SEPARATOR =
"||".freeze

Class Method Summary collapse

Class Method Details

.allowed?(cmd) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/simultaneous/command.rb', line 11

def self.allowed?(cmd)
  allowed_commands.include?(cmd.class)
end

.allowed_commandsObject



15
16
17
18
19
# File 'lib/simultaneous/command.rb', line 15

def self.allowed_commands
  @allowed_commands ||= self.constants.map { |c| self.const_get(c) }.select do |k|
    k.respond_to?(:ancestors) && k.ancestors.include?(CommandBase)
  end
end

.load(command) ⇒ Object



7
8
9
# File 'lib/simultaneous/command.rb', line 7

def self.load(command)
  Marshal.load(command)
end