るりまサーチ

最速Rubyリファレンスマニュアル検索!
154件ヒット [1-100件を表示] (0.072秒)

別のキーワード

  1. _builtin >
  2. bigdecimal >
  3. complex >
  4. float >
  5. module >

ライブラリ

クラス

検索結果

<< 1 2 > >>

Module#constants(inherit = true) -> [Symbol] (18262.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...
...1

# Bar は BAR を含む
p constants # => [:BAR]
# 出力に FOO は含まれない
p Module.constants - $clist # => [:BAR, :Bar, :Foo]
class Baz
# Baz は定数を含まない
p constants # => []

# ネストしたクラ...

RDoc::Context#constants -> [RDoc::Constant] (18202.0)

追加された RDoc::Constant の配列を返します。

追加された RDoc::Constant の配列を返します。

Socket::AncillaryData#timestamp -> Time (143.0)

タイムスタンプ制御メッセージに含まれる時刻を Time オブジェクト で返します。

...l
#=> #<Socket::AncillaryData: INET SOCKET TIMESTAMP 2009-02-24 17:35:46.775581>
t = ctl.timestamp
p t #=> 2009-02-24 17:35:46 +0900
p t.usec #=> 775581
p t.nsec #=> 775581000
}
}

@see Socket::Constants::SCM_TIMESTAMP,
Socket::Constants::SCM_TIMESTA...
...MPNS,
Socket::Constants::SCM_BINTIME,
Socket::Constants::SO_TIMESTAMP,
Socket::Constants::SO_TIMESTAMPNS,
Socket::Constants::SO_BINTIME...

Socket::AncillaryData#unix_rights -> [IO] | nil (125.0)

Unix domain socket の SCM_RIGHTS 制御メッセージに含まれる ファイルディスクリプタを IO オブジェクトの配列として返します。

...cket です。

この配列は Socket::AncillaryData が初期化されたときに
作られます。例えば BasicSocket#recvmsg を :scm_rights => true
オプションを付けて呼びだし、
SCM_RIGHTS な 制御メッセージを受け取ったときに配列が作られます。
適切...
...eeds :scm_rights=>true for unix_rights
s1, s2 = UNIXSocket.pair
p s1 #=> #<UNIXSocket:fd 3>
s1.sendmsg "stdin and a socket", 0, nil, Socket::AncillaryData.unix_rights(STDIN, s1)
_, _, _, ctl = s2.recvmsg(:scm_rights=>true)
p ctl
#=> #<Socket::Ancil...
...laryData: UNIX SOCKET RIGHTS 6 7>
p ctl.unix_rights #=> [#<IO:fd 6>, #<Socket:fd 7>]
p File.identical?(STDIN, ctl.unix_rights[0]) #=> true
p File.identical?(s1, ctl.unix_rights[1]) #=> true

# If :scm_rights=>true is not given, unix_rights returns nil
s1, s2...

File#flock(operation) -> 0 | false (113.0)

ファイルをロックします。

...に発生します。

引数 operation に有効な定数は以下の通りです。定数は File::Constants で定義されていますが、
File クラスの親クラスの IO が File::Constants をインクルードしているので、
これらの定数は File::LOCK_SH などとして参...
...:LOCK_UN)
puts "unlocked by process1"
sleep 1 # <- 子プロセスが確実に先にロックするための sleep
f.flock(File::LOCK_EX)
puts "re-locked by process1"

# => locked by process1
# unlocked by process1
# locked by process2
# unlocked by process2
# re-locked by process1
//}...

絞り込み条件を変える

Module#class_variables(inherit = true) -> [Symbol] (113.0)

クラス/モジュールに定義されているクラス変数の名前の配列を返します。

...d
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_variables, Object#instance_variables, Module#constants...

Object#instance_variables -> [Symbol] (113.0)

オブジェクトのインスタンス変数名をシンボルの配列として返します。

...列として返します。

//emlist[][ruby]{
obj = Object.new
obj.instance_eval { @foo, @bar = nil }
p obj.instance_variables

#=> [:@foo, :@bar]
//}

@see Object#instance_variable_get, Kernel.#local_variables, Kernel.#global_variables, Module.constants, Module#constants, Module#class_variables...

Socket::AncillaryData#ipv6_pktinfo_addr -> Addrinfo (113.0)

自身の type が IPV6_PKTINFO である場合、保持しているデータ (アドレス、インターフェースのインデックス) のアドレスを返します。

...ifindex = 0
ancdata = Socket::AncillaryData.ipv6_pktinfo(addr, ifindex)
p ancdata.ipv6_pktinfo_addr #=> #<Addrinfo: ::1>

@see Socket::AncillaryData.ipv6_pktinfo,
Socket::AncillaryData#ipv6_pktinfo,
Socket::AncillaryData#ipv6_pktinfo_ifindex,
Socket::Constants::IPV6_PKTINFO...

File#path -> String (107.0)

オープン時に使用したパスを文字列で返します。

...れていたり、
File::Constants::TMPFILEオプション付きで作成されていたりする場合です。

//emlist[例][ruby]{
File.open("testfile") {|f| f.path } #=> "testfile"
File.open("/tmp/../tmp/xxx", "w") {|f| f.path } #=> "/tmp/../tmp/xxx"
File.open(...
..."/tmp", File::RDWR | File::TMPFILE){|f| f.path } #=> "/tmp"
//}...
...ise IOError TMPFILE File::Constants::TMPFILEオプション付きで作成されている場合に発生します。

//emlist[例][ruby]{
File.open("testfile") {|f| f.path } #=> "testfile"
File.open("/tmp/../tmp/xxx", "w") {|f| f.path } #=> "/tmp/../tmp/xxx"
File.o...

File#to_path -> String (107.0)

オープン時に使用したパスを文字列で返します。

...れていたり、
File::Constants::TMPFILEオプション付きで作成されていたりする場合です。

//emlist[例][ruby]{
File.open("testfile") {|f| f.path } #=> "testfile"
File.open("/tmp/../tmp/xxx", "w") {|f| f.path } #=> "/tmp/../tmp/xxx"
File.open(...
..."/tmp", File::RDWR | File::TMPFILE){|f| f.path } #=> "/tmp"
//}...

絞り込み条件を変える

<< 1 2 > >>