module FFWD::Plugin::JSON
Constants
- DEFAULT_HOST
- DEFAULT_KIND
- DEFAULT_PORT
- DEFAULT_PROTOCOL
- KINDS
Public Class Methods
setup_input(opts)
click to toggle source
# File lib/ffwd/plugin/json.rb, line 84 def self.setup_input opts opts[:host] ||= DEFAULT_HOST opts[:port] ||= DEFAULT_PORT kind = (opts[:kind] || DEFAULT_KIND).to_s unless connection = KINDS[kind] raise "No such protocol kind: #{kind}" end protocol = FFWD.parse_protocol opts[:protocol] || DEFAULT_PROTOCOL[kind] if connection == FrameConnection and protocol != FFWD::UDP log.warning "When using :frame kind, you should use the UDP protocol." + " Not #{protocol.family.to_s.upcase}" end if connection == LineConnection and protocol != FFWD::TCP log.warning "When using :line kind, you should use the TCP protocol. " + "Not #{protocol.family.to_s.upcase}" end protocol.bind opts, log, connection end