module Sqreen::Actions
Implements actions (behavior taken in response to agent signals)
Implements actions (behavior taken in response to agent signals)
Implements actions (behavior taken in response to agent signals)
Public Class Methods
deserialize_action(hash)
click to toggle source
@return [Sqreen::Actions::Base]
# File lib/sqreen/actions.rb, line 20 def self.deserialize_action(hash) action_type = hash['action'] raise 'no action type available' unless action_type subclass = Sqreen::Actions::Base.get_type_class(action_type) raise Sqreen::Actions::UnknownActionType, action_type unless subclass id = hash['action_id'] raise 'no action id available' unless id duration = hash['duration'] if !duration.nil? && duration <= 0 Sqreen.log.debug "Action #{id} is already expired" return nil end opts = { :duration => duration, :send_response => hash['send_response'], } subclass.new(id, opts, hash['parameters'] || {}) end