22件ヒット
[1-22件を表示]
(0.104秒)
検索結果
-
Module
# constants(inherit = true) -> [Symbol] (18168.0) -
そのモジュール(またはクラス)で定義されている定数名の配列を返します。
...定数は含まれません。 Object.constants とすると Object クラスで定義された
定数の配列が得られます。
得られる定数の順序は保証されません。
@param inherit true を指定するとスーパークラスや include したモジュールで
定義......dule.constants, Kernel.#local_variables, Kernel.#global_variables, Object#instance_variables, Module#class_variables
//emlist[Module.constants と Module#constants の違い][ruby]{
# 出力の簡略化のため起動時の定数一覧を取得して後で差し引く
$clist = Module.constants
cla......s Bar
BAR = 1
# Bar は BAR を含む
p constants # => [:BAR]
# 出力に FOO は含まれない
p Module.constants - $clist # => [:BAR, :Bar, :Foo]
class Baz
# Baz は定数を含まない
p constants # => []
# ネス... -
Socket
# connect _ nonblock(server _ sockaddr) -> 0 (13.0) -
ソケットをノンブロッキングモードに設定した後、 connect(2) を呼び出します。
...れを connect_nonblock をリトライするために使うことができます。
# Pull down Google's web page
require 'socket'
include Socket::Constants
socket = Socket.new(AF_INET, SOCK_STREAM, 0)
sockaddr = Socket.sockaddr_in(80, 'www.google.com')
begin # emulate blocking connect...