37件ヒット
[1-37件を表示]
(0.074秒)
種類
- モジュール関数 (22)
- 特異メソッド (10)
- インスタンスメソッド (5)
ライブラリ
- ビルトイン (37)
クラス
- Module (5)
キーワード
- []= (5)
-
caller
_ locations (22) -
const
_ source _ location (5)
検索結果
先頭5件
-
Warning
. [](category) -> bool (18300.0) -
...
category の種類の警告を表示するかどうかのフラグを返します。
@param category 警告の種類を指定します。
サポートされている category は以下の通りです。
: :deprecated
非推奨の警告。
例: nil ではない値を $, や $; に設定す......る、キーワード引数、ブロックなしで proc / lambda を呼び出す、等
: :experimental
実験的な機能。
例: パターンマッチング... -
Kernel
. # caller _ locations(range) -> [Thread :: Backtrace :: Location] | nil (12306.0) -
現在のフレームを Thread::Backtrace::Location の配列で返します。引 数で指定した値が範囲外の場合は nil を返します。
...現在のフレームを Thread::Backtrace::Location の配列で返します。引
数で指定した値が範囲外の場合は nil を返します。
@param start 開始フレームの位置を数値で指定します。
@param length 取得するフレームの個数を指定します。
@pa......//emlist[例][ruby]{
def test1(start, length)
locations = caller_locations(start, length)
p locations
p locations.map(&:lineno)
p locations.map(&:path)
end
def test2(start, length)
test1(start, length)
end
def test3(start, length)
test2(start, length)
end
caller_locations # => []
tes......t3(1, nil)
# => ["/Users/user/test.rb:9:in `test2'", "/Users/user/test.rb:13:in `test3'", "/Users/user/test.rb:17:in `<main>'"]
# => [9, 13, 17]
# => ["/Users/user/test.rb", "/Users/user/test.rb", "/Users/user/test.rb"]
test3(1, 2)
# => ["/Users/user/test.rb:9:in `test2'", "/Users/user/test.rb:13:in... -
Kernel
. # caller _ locations(start = 1 , length = nil) -> [Thread :: Backtrace :: Location] | nil (12306.0) -
現在のフレームを Thread::Backtrace::Location の配列で返します。引 数で指定した値が範囲外の場合は nil を返します。
...現在のフレームを Thread::Backtrace::Location の配列で返します。引
数で指定した値が範囲外の場合は nil を返します。
@param start 開始フレームの位置を数値で指定します。
@param length 取得するフレームの個数を指定します。
@pa......//emlist[例][ruby]{
def test1(start, length)
locations = caller_locations(start, length)
p locations
p locations.map(&:lineno)
p locations.map(&:path)
end
def test2(start, length)
test1(start, length)
end
def test3(start, length)
test2(start, length)
end
caller_locations # => []
tes......t3(1, nil)
# => ["/Users/user/test.rb:9:in `test2'", "/Users/user/test.rb:13:in `test3'", "/Users/user/test.rb:17:in `<main>'"]
# => [9, 13, 17]
# => ["/Users/user/test.rb", "/Users/user/test.rb", "/Users/user/test.rb"]
test3(1, 2)
# => ["/Users/user/test.rb:9:in `test2'", "/Users/user/test.rb:13:in... -
Module
# const _ source _ location(name , inherited = true) -> [String , Integer] (12206.0) -
name で指定した定数の定義を含むソースコードのファイル名と行番号を配列で返します。
...号を配列で返します。
@param name Symbol,String で定数の名前を指定します。
@param inherited true を指定するとスーパークラスや include したモジュールで定義された定数が対象にはなります。false を指定した場合 対象にはなりませ......ます。
//emlist[例][ruby]{
# test.rb:
class A # line 1
C1 = 1
C2 = 2
end
module M # line 6
C3 = 3
end
class B < A # line 10
include M
C4 = 4
end
class A # 継続して A を定義する
C2 = 8 # 定数を再定義する
end
p B.const_source_location('C4')......_source_location('A') # => ["test.rb", 1] -- Object は継承していないが追加で modules をチェックする
p Object.const_source_location('A::C1') # => ["test.rb", 2] -- ネストの指定もサポートしている
p Object.const_source_location('String') # => [] --... -
Warning
. []=(category , flag) -> flag (6400.0) -
category の警告を表示するかどうかのフラグを設定します。 サポートされている category については Warning.[] を参照してください。
...
category の警告を表示するかどうかのフラグを設定します。
サポートされている category については Warning.[] を参照してください。
@param category 警告の種類を指定します。
@param flag 真、または偽を指定します。
@see Warning.[]...