Module: FireAndForget::Command

Defined in:
lib/fire_and_forget/command.rb,
lib/fire_and_forget/command/fire.rb,
lib/fire_and_forget/command/kill.rb,
lib/fire_and_forget/command/get_pid.rb,
lib/fire_and_forget/command/set_pid.rb,
lib/fire_and_forget/command/get_status.rb,
lib/fire_and_forget/command/set_status.rb

Defined Under Namespace

Classes: CommandBase, Fire, GetPid, GetStatus, Kill, SetPid, SetStatus

Constant Summary collapse

SEPARATOR =
"||".freeze

Class Method Summary collapse

Class Method Details

.allowed?(cmd) ⇒ Boolean

Returns:

  • (Boolean)


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

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

.allowed_commandsObject



14
15
16
17
18
# File 'lib/fire_and_forget/command.rb', line 14

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



6
7
8
# File 'lib/fire_and_forget/command.rb', line 6

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