module H2::FrameDebugger

Public Class Methods

included(base) click to toggle source
# File lib/h2.rb, line 138
def self.included base
  base::PARSER_EVENTS.push :frame_sent, :frame_received
end

Public Instance Methods

on_frame_received(f) click to toggle source
# File lib/h2.rb, line 146
def on_frame_received f
  Logger.debug "Received frame: #{truncate_frame(f).inspect}"
end
on_frame_sent(f) click to toggle source
# File lib/h2.rb, line 142
def on_frame_sent f
  Logger.debug "Sent frame: #{truncate_frame(f).inspect}"
end

Private Instance Methods

truncate_frame(f) click to toggle source
# File lib/h2.rb, line 156
def truncate_frame f
  f.reduce({}) { |h, (k, v)| h[k] = truncate_string(v); h }
end
truncate_string(s) click to toggle source
# File lib/h2.rb, line 152
def truncate_string s
  (String === s && s.length > 64) ? "#{s[0,64]}..." : s
end