Sha256: dd1b0b064ee0c487f13726090bc4d3a45b4033513a61f0de903733311edc9300
Contents?: true
Size: 880 Bytes
Versions: 2
Compression:
Stored size: 880 Bytes
Contents
require 'json' module Kcl class IOHandler def initialize input, output, error @input = input @output = output @error = error end def write_action response write_line response.to_json end def read_action line = input.gets JSON.parse line unless line.nil? || line.empty? rescue => error raise ReadError.new(error, line) end def write_error error_message error << "#{error_message}\n" ensure error.flush end private attr_reader :input, :output, :error def write_line line output << "\n#{line}\n" ensure output.flush end class ReadError < StandardError attr_reader :base_error, :line def initialize base_error, line super base_error.message @base_error = base_error @line = line end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
amazon-kinesis-client-ruby-0.0.3 | lib/kcl/io_handler.rb |
amazon-kinesis-client-ruby-0.0.1 | lib/kcl/io_handler.rb |