class Wamp::Worker::Queue::Descriptor
This class represents the payload that will be stored in Redis
Attributes
command[R]
handle[R]
params[R]
Public Class Methods
from_json(json_string)
click to toggle source
Create a Descriptor
object from the json payload
@param json_string [String] - The string from the Redis store @return [Descriptor] - The instantiated descriptor
# File lib/wamp/worker/queue.rb, line 28 def self.from_json(json_string) return unless json_string parsed = JSON.parse(json_string, :symbolize_names => true) self.new(parsed[:command], parsed[:handle], parsed[:params]) end
new(command, handle, params)
click to toggle source
Constructor
@param command [Symbol] - The command for the descriptor @param handle [String] - The handle representing the descriptor @param params [Hash] - The params for the command
# File lib/wamp/worker/queue.rb, line 18 def initialize(command, handle, params) @command = command.to_sym @handle = handle @params = params || {} end
Public Instance Methods
to_json()
click to toggle source
Creates the json payload from the object
@return [String] - The string that will go into the Redis store
# File lib/wamp/worker/queue.rb, line 37 def to_json { command: self.command, handle: self.handle, params: self.params }.to_json end