Class: Mingle::Io::Stream::Connection

Inherits:
BitGirder::Core::BitGirderClass show all
Includes:
Mingle
Defined in:
lib/mingle/io/stream.rb

Constant Summary

Constants included from Mingle

COMPARABLE_TYPES, Mingle::ID_STYLES, Mingle::ID_STYLE_LC_CAMEL_CAPPED, Mingle::ID_STYLE_LC_HYPHENATED, Mingle::ID_STYLE_LC_UNDERSCORE, Mingle::INT_TYPES, NUM_TYPES, PARSED_TYPES, QNAME_RESOLV_MAP, USE_ICONV

Constants included from BitGirder::Core::BitGirderMethods

BitGirder::Core::BitGirderMethods::PARAM_TYPE_ARG, BitGirder::Core::BitGirderMethods::PARAM_TYPE_ENVVAR, BitGirder::Core::BitGirderMethods::PARAM_TYPE_KEY

Instance Method Summary collapse

Methods included from Mingle

cast_value, quote_value

Methods included from BitGirder::Core::BitGirderMethods

argv_to_argh, check_fail_prefix, class_name_to_sym, code, compares_to, console, ext_to_class_name, ext_to_sym, has_env, has_key, has_keys, nonnegative, not_nil, positive, raisef, set_from_key, set_var, split_argv, sym_to_cli_switch, sym_to_ext_id, to_bool, unpack_argv_array, unpack_argv_hash, warn

Methods included from BitGirder::Core::BitGirderStructure

#==, included

Instance Method Details

#read_messageObject



72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/mingle/io/stream.rb', line 72

def read_message
    
    @dec.expect_version( MESSAGE_VERSION1, "message" )

    @dec.expect_type_code( TYPE_CODE_HEADERS )
    hdrs = @dec.read_headers

    @dec.expect_type_code( TYPE_CODE_MESSAGE_BODY )
    body = read_body
    
    Message.new( :headers => hdrs, :body => body )
end

#write_message(msg) ⇒ Object



55
56
57
58
59
60
61
62
63
# File 'lib/mingle/io/stream.rb', line 55

def write_message( msg )

    msg = Message.as_instance( msg )

    @enc.write_int32( MESSAGE_VERSION1 )
    write_headers( msg.headers )
    write_body( msg.body )
    @writer.flush
end