Module: StickyElephant::PayloadTypes

Included in:
Payload
Defined in:
lib/sticky_elephant/payload_types.rb

Constant Summary collapse

TYPES =

Order matters

%i( quit ssl_request query handshake invalid ).freeze

Instance Method Summary collapse

Instance Method Details

#handlerObject



13
14
15
# File 'lib/sticky_elephant/payload_types.rb', line 13

def handler
  TYPES_HANDLERS.fetch(type)
end

#typeObject

Raises:

  • (RuntimeError)


6
7
8
9
10
11
# File 'lib/sticky_elephant/payload_types.rb', line 6

def type
  return @type if defined? @type
  _type = TYPES.find {|sym| send("is_#{sym}?") }
  raise RuntimeError.new("Unable to find type for #{self}") if _type.nil?
  @type = _type
end