36件ヒット
[1-36件を表示]
(0.123秒)
キーワード
-
class
_ variables (12) -
connect
_ nonblock (12)
検索結果
先頭3件
-
Module
# constants(inherit = true) -> [Symbol] (18180.0) -
そのモジュール(またはクラス)で定義されている定数名の配列を返します。
...ます。
Object のサブクラスの場合、Objectやそのスーパークラスで定義されている
定数は含まれません。 Object.constants とすると Object クラスで定義された
定数の配列が得られます。
得られる定数の順序は保証されません。
@p......dule.constants, Kernel.#local_variables, Kernel.#global_variables, Object#instance_variables, Module#class_variables
//emlist[Module.constants と Module#constants の違い][ruby]{
# 出力の簡略化のため起動時の定数一覧を取得して後で差し引く
$clist = Module.constants
cla......ss Foo
FOO = 1
end
class Bar
BAR = 1
# Bar は BAR を含む
p constants # => [:BAR]
# 出力に FOO は含まれない
p Module.constants - $clist # => [:BAR, :Bar, :Foo]
class Baz
# Baz は定数を含まない
p constants... -
Module
# class _ variables(inherit = true) -> [Symbol] (25.0) -
クラス/モジュールに定義されているクラス変数の名前の配列を返します。
...。
//emlist[例][ruby]{
class One
@@var1 = 1
end
class Two < One
@@var2 = 2
end
One.class_variables # => [:@@var1]
Two.class_variables # => [:@@var2, :@@var1]
Two.class_variables(false) # => [:@@var2]
//}
@see Module.constants, Kernel.#local_variables, Kernel.#global_varia... -
Socket
# connect _ nonblock(server _ sockaddr) -> 0 (19.0) -
ソケットをノンブロッキングモードに設定した後、 connect(2) を呼び出します。
...rrno::EINPROGRESS)
には IO::WaitWritable が Object#extend されます。
これを connect_nonblock をリトライするために使うことができます。
# Pull down Google's web page
require 'socket'
include Socket::Constants
socket = Socket.new(AF_INET, SOCK_STREAM, 0)
sockad......cket]) # wait 3-way handshake completion
begin
socket.connect_nonblock(sockaddr) # check connection failure
rescue Errno::EISCONN
end
end
socket.write("GET / HTTP/1.0\r\n\r\n")
results = socket.read
@param server_sockaddr 接続先アドレス
@raise Errno::EXXX connect(2)...