diff options
author | aamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-06-26 23:49:21 +0000 |
---|---|---|
committer | aamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-06-26 23:49:21 +0000 |
commit | c664027a342785089cc09169ff167350e840baa9 (patch) | |
tree | 2b74c20ddbfd9371414294e4c34ea3ce1e5afe95 /lib/net/protocol.rb | |
parent | 10e80b2402f7c0fd79df86767a11ba4e4b1bfa95 (diff) |
aamine
* lib/net/pop.rb: new methods POP3.auth_only, POP3#auth_only
* lib/net/http.rb: HTTP.Proxy returns self if ADDRESS is nil.
* lib/net/protocol.rb: new method ProtocolError#response
* lib/net/protocol.rb,smtp.rb,pop.rb,http.rb: add document.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/net/protocol.rb')
-rw-r--r-- | lib/net/protocol.rb | 94 |
1 files changed, 27 insertions, 67 deletions
diff --git a/lib/net/protocol.rb b/lib/net/protocol.rb index a440ef0817..52c4926d43 100644 --- a/lib/net/protocol.rb +++ b/lib/net/protocol.rb @@ -1,62 +1,18 @@ =begin -= net/protocol.rb version 1.2.0 += net/protocol.rb version 1.2.1 - Copyright (C) 1999-2001 Yukihiro Matsumoto +Copyright (c) 1999-2001 Yukihiro Matsumoto - written & maintained by Minero Aoki <aamine@dp.u-netsurf.ne.jp> +written & maintained by Minero Aoki <aamine@loveruby.net> - This program is free software. You can re-distribute and/or - modify this program under the same terms as Ruby itself, - GNU General Public License or Ruby License. +This program is free software. You can re-distribute and/or +modify this program under the same terms as Ruby itself, +Ruby Distribute License or GNU General Public License. - Japanese version of this document is in "net" full package. - You can get it from RAA (Ruby Application Archive). RAA is: - http://www.ruby-lang.org/en/raa.html - - -== Net::Protocol - -the abstract class for some internet protocols - -=== Super Class - -Object - -=== Class Methods - -: new( address = 'localhost', port = nil ) - This method Creates a new protocol object. - -: start( address = 'localhost', port = nil, *protoargs ) -: start( address = 'localhost', port = nil, *protoargs ) {|proto| .... } - This method creates a new Protocol object and opens a session. - equals to Net::Protocol.new( address, port ).start( *protoargs ) - -=== Methods - -: address - the address of connecting server (FQDN). - -: port - connecting port number - -: start( *args ) -: start( *args ) {|proto| .... } - This method starts protocol. If protocol was already started, - do nothing and returns false. - - '*args' are specified in subclasses. - - When is called with block, gives Protocol object to block and - close session when block finished. - -: finish - This method ends protocol. If you call this method before protocol starts, - it only return false without doing anything. - -: active? - true if session have been started +NOTE: You can get Japanese version of this document from +Ruby Documentation Project (RDP): +((<URL:http://www.ruby-lang.org/~rubikitch/RDP.cgi>)) =end @@ -76,8 +32,7 @@ module Net class Protocol - Version = '1.2.0' - + Version = '1.2.1' class << self @@ -106,13 +61,17 @@ module Net # - # sub-class requirements + # --- Configuration Staffs for Sub Classes --- + # + # protocol_param port + # protocol_param command_type + # protocol_param socket_type (optional) # - # protocol_param command_type - # protocol_param port + # private method do_start (optional) + # private method do_finish (optional) # - # private method do_start (optional) - # private method do_finish (optional) + # private method on_connect (optional) + # private method on_disconnect (optional) # protocol_param :port, 'nil' @@ -267,8 +226,8 @@ module Net "#<#{type} #{code}>" end - def error!( data = nil ) - raise code_type.error_type.new( code + ' ' + Net.quote(msg), data ) + def error! + raise code_type.error_type.new( code + ' ' + Net.quote(msg), self ) end end @@ -288,12 +247,13 @@ module Net class ProtocolError - def initialize( msg, data = nil ) + def initialize( msg, resp ) super msg - @data = data + @response = resp end - attr :data + attr :response + alias data response def inspect "#<#{type}>" @@ -644,7 +604,7 @@ module Net # private use only (can not handle 'break') def read_pendlist - D_off 'reading list...' + # D_off 'reading list...' str = nil i = 0 @@ -654,7 +614,7 @@ module Net yield str end - D_on "read #{i} items" + # D_on "read #{i} items" end |