66件ヒット
[1-66件を表示]
(0.231秒)
種類
- インスタンスメソッド (32)
- 文書 (23)
- クラス (11)
ライブラリ
- ビルトイン (43)
クラス
- Method (10)
-
Thread
:: Backtrace :: Location (22)
キーワード
-
NEWS for Ruby 2
. 0 . 0 (11) -
NEWS for Ruby 2
. 5 . 0 (7) -
NEWS for Ruby 2
. 7 . 0 (5) - inspect (16)
検索結果
先頭5件
-
Thread
:: Backtrace :: Location # to _ s -> String (21107.0) -
self が表すフレームを Kernel.#caller と同じ表現にした文字列を返し ます。
...列を返し
ます。
//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
puts call.to_s
end
# => path/to/foo.rb:5:in `initialize'
# path/to/foo.rb:9:in `new'
# path/to... -
Thread
:: Backtrace :: Location (18012.0) -
Ruby のフレームを表すクラスです。
...er_locations から生成されます。
//emlist[例1][ruby]{
# caller_locations.rb
def a(skip)
caller_locations(skip)
end
def b(skip)
a(skip)
end
def c(skip)
b(skip)
end
c(0..2).map do |call|
puts call.to_s
end
//}
例1の実行結果:
caller_locations.rb:2:in `a'
caller_locations.......rb:5:in `b'
caller_locations.rb:8:in `c'
//emlist[例2][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
puts call.to_s
end
//}
例2の実行結果:
init.rb:4:in `initialize'... -
Method
# to _ s -> String (15113.0) -
self を読みやすい文字列として返します。
...ュール名、
method は、メソッド名を表します。
arg は引数を表します。
「foo.rb:2」は Method#source_location を表します。
source_location が nil の場合には付きません。
//emlist[例][ruby]{
module Foo
def foo
"foo"
end
end
class Bar
include Foo... -
Thread
:: Backtrace :: Location # inspect -> String (3032.0) -
Thread::Backtrace::Location#to_s の結果を人間が読みやすいような文 字列に変換したオブジェクトを返します。
...ktrace::Location#to_s の結果を人間が読みやすいような文
字列に変換したオブジェクトを返します。
//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map d... -
NEWS for Ruby 2
. 7 . 0 (48.0) -
NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...Numbered parameters)がデフォルトのブロックの仮引数として
導入されました。 4475
//emlist[][ruby]{
[1, 2, 10].map { _1.to_s(16) } #=> ["1", "2", "a"]
[[1, 2], [3, 4]].map { _1 + _2 } #=> [3, 7]
//}
* 「_1」などはまだローカル変数名として使えて......た。 15323
* Enumerable#tallyが追加されました。 11076
//emlist[Enumerable#filter_map][ruby]{
[1, 2, 3].filter_map {|x| x.odd? ? x.to_s : nil } #=> ["1", "3"]
//}
//emlist[Enumerable#tally][ruby]{
["A", "B", "C", "B", "A"].tally #=> {"A"=>2, "B"=>2, "C"=>1}
//}
* Enumerator
*......情報が増えました。 14145
* Module
* 新規メソッド
* 定数が定義された場所を取得するModule#const_source_location
メソッドが追加されました。 10771
* 通常の引数分解でキーワード引数を渡すようにメソッドに印を... -
NEWS for Ruby 2
. 0 . 0 (42.0) -
NEWS for Ruby 2.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...のソースファイル(__FILE__)のあるディレクトリ名を正規化された絶対パ スで返します。
* 追加: Kernel.#caller_locations フレーム情報の配列を返します
* 拡張: Kernel.#warn Kernel.#puts のように複数の引数を受け付けるようになり......たときの名前ではなく呼び出したときの名前を返します。
* 非互換: Object#inspect は #to_s を呼び出さなくなりました。再定義された #to_s を呼び出すためです。
* LoadError
* 追加: LoadError#path ロードできなかったファイル......* 追加: Thread#backtrace_locations Kernel#caller_locations に似た情報を返します
* 新規クラス: Thread::Backtrace::Location to hold backtrace location
information. These are returned by Thread#backtrace_locations and
Kernel#caller_locations
* 非互換: Thread#jo... -
NEWS for Ruby 2
. 5 . 0 (18.0) -
NEWS for Ruby 2.5.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...11547
* do/end ブロック内部で rescue/else/ensure を書けるようになりました 12906
* 文字列の式展開内部の暗黙の to_s 呼び出しにも refinements が影響するようになりました 13812
=== 組み込みクラスの更新
* Array
* Array#append を......safe_load like JSON.parse
https://github.com/ruby/psych/pull/333, https://github.com/ruby/psych/pull/337
* Add Psych::Handler#event_location
https://github.com/ruby/psych/pull/326
* Make frozen string literal = true
https://github.com/ruby/psych/pull/320
* P......ml
* https://blog.rubygems.org/2017/08/27/2.6.13-released.html
* securerandom
* SecureRandom.alphanumeric を追加
* set
* Set#to_s を Set#inspect の別名として追加 13676
* Set#=== を Set#include? の別名として追加 13801
* Set#reset 6589
* stringio... -
Method
# inspect -> String (13.0) -
self を読みやすい文字列として返します。
...ュール名、
method は、メソッド名を表します。
arg は引数を表します。
「foo.rb:2」は Method#source_location を表します。
source_location が nil の場合には付きません。
//emlist[例][ruby]{
module Foo
def foo
"foo"
end
end
class Bar
include Foo...