55件ヒット
[1-55件を表示]
(0.052秒)
別のキーワード
種類
- インスタンスメソッド (44)
- 文書 (11)
ライブラリ
- ビルトイン (44)
クラス
- Binding (6)
- Method (11)
- Module (5)
- Proc (11)
- UnboundMethod (11)
キーワード
検索結果
先頭5件
-
Proc
# source _ location -> [String , Integer] | nil (24231.0) -
ソースコードのファイル名と行番号を配列で返します。
...by]{
# /path/to/target.rb を実行
proc {}.source_location # => ["/path/to/target.rb", 1]
proc {}.source_location # => ["/path/to/target.rb", 2]
(eval "proc {}").source_location # => ["(eval)", 1]
method(:p).to_proc.source_location # => nil
//}
@see Method#source_location... -
UnboundMethod
# source _ location -> [String , Integer] | nil (24225.0) -
ソースコードのファイル名と行番号を配列で返します。
...nil を返します。
//emlist[例][ruby]{
require 'time'
Time.instance_method(:zone).source_location # => nil
Time.instance_method(:httpdate).source_location # => ["/Users/user/.rbenv/versions/2.4.3/lib/ruby/2.4.0/time.rb", 654]
//}
@see Proc#source_location, Method#source_location... -
Method
# source _ location -> [String , Integer] | nil (24219.0) -
ソースコードのファイル名と行番号を配列で返します。
...@see Proc#source_location
//emlist[例][ruby]{
# ------- /tmp/foo.rb ---------
class Foo
def foo; end
end
# ----- end of /tmp/foo.rb ----
require '/tmp/foo'
m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m.source_location # => ["/tmp/foo.rb", 2]
method(:puts).source_location # => nil
//}... -
Binding
# source _ location -> [String , Integer] (24207.0) -
self の Ruby のソースファイル名と行番号を返します。
...self の Ruby のソースファイル名と行番号を返します。
d:spec/variables#pseudo の __FILE__ と __LINE__ も参照してください。
//emlist[例][ruby]{
p binding.source_location # => ["test.rb", 1]
//}... -
Module
# const _ source _ location(name , inherited = true) -> [String , Integer] (12267.0) -
name で指定した定数の定義を含むソースコードのファイル名と行番号を配列で返します。
...C2 = 8 # 定数を再定義する
end
p B.const_source_location('C4') # => ["test.rb", 12]
p B.const_source_location('C3') # => ["test.rb", 7]
p B.const_source_location('C1') # => ["test.rb", 2]
p B.const_source_location('C3', false) # => nil -- include したモ......しない
p A.const_source_location('C2') # => ["test.rb", 16] -- 最後に定義された位置を返す
p Object.const_source_location('B') # => ["test.rb", 10] -- Object はトップレベルの定数を検索する
p Object.const_source_location('A') # => ["test.rb", 1] -......を返す
p B.const_source_location('A') # => ["test.rb", 1] -- Object を継承している為
p M.const_source_location('A') # => ["test.rb", 1] -- Object は継承していないが追加で modules をチェックする
p Object.const_source_location('A::C1') # => ["t... -
NEWS for Ruby 2
. 7 . 0 (18.0) -
NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...omparable#clampや定数やDSLなどで便利かもしれません。
14799
//emlist[][ruby]{
ary[..3] # identical to ary[0..3]
case RUBY_VERSION
when ..."2.4" then puts "EOL"
# ...
end
age.clamp(..100)
where(sales: ..100)
//}
* 「$;」にnil以外の値を設定すると警告が出る......重代入でのrescue修飾子が単一の代入と同じ振る舞いになりました。 8279
//emlist[][ruby]{
a, b = raise rescue [1, 2]
# Previously parsed as: (a, b = raise) rescue [1, 2]
# Now parsed as: a, b = (raise rescue [1, 2])
//}
* 特異クラス構文での yield は警......くる情報が増えました。 14145
* Module
* 新規メソッド
* 定数が定義された場所を取得するModule#const_source_location
メソッドが追加されました。 10771
* 通常の引数分解でキーワード引数を渡すようにメソッドに... -
NEWS for Ruby 2
. 6 . 0 (12.0) -
NEWS for Ruby 2.6.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...れるときに、
例外の Exception#cause も表示されるようになりました。 8257
* フリップフロップが非推奨になりました。 5400
=== 組み込みクラスの更新
* Array
* 新規メソッド
* Array#union と Array#difference 14097
* 変更......* Array#filter! が Array#select! の別名として追加されました。 13784
* Binding
* 新規メソッド
* Binding#source_location 追加 14230
* bindingのソースコード上の位置を __FILE__ と __LINE__ の二要素配列として返します。......取り、環境変数名と値のペアを新しいキーと値に変換できるようになりました。 15143
* Exception
* 新規オプション
* Exception#full_message が :highlight と :order を受け付けるようになりました。 14324
* Hash
* 変更された...