33件ヒット
[1-33件を表示]
(0.021秒)
キーワード
-
NEWS for Ruby 2
. 5 . 0 (7) -
NEWS for Ruby 3
. 0 . 0 (4) - irb (11)
検索結果
-
pp (38168.0)
-
オブジェクトなどを見やすく出力するためのライブラリです。
...。
このライブラリを require すると Kernel.#pp が定義されます。
Kernel.#p のかわりに Kernel.#pp を使うことにより、
適切にインデントと改行された分かりやすい出力を得ることが出来ます。
pp ライブラリは、ユーザがあたらしく......ように作られていますので、Kernel.#pp を使う上で余計な作業をする
必要はありません。
=== どちらが読みやすいでしょうか?
p による pretty-print されてない出力:
#<PP:0x81a0d10 @stack=[], @genspace=#<Proc:0x81a0cc0>, @nest=[0], @newline="\n",......], @singleline_width=1>, #
<PrettyPrint::Text:0x81a0a7c @tail=0, @width=1, @text=",">, #<PrettyPrint::Break
able:0x81a0a2c @group=2, @gensace=#<Proc:0x81a0cc0>, @newline="\n", @indent=1, @
tail=2, @sep=" ", @width=1>, #<PrettyPrint::Group:0x81a09c8 @group=2, @tail=1, @
buf=[#<PrettyPrint::Te......などを見やすく出力するためのライブラリです。
pp ライブラリは、ユーザがあたらしく定義したクラスに対しても見やすい表示を
するように作られていますので、Kernel.#pp を使う上で余計な作業をする
必要はありません。......=== どちらが読みやすいでしょうか?
p による pretty-print されてない出力:
#<PP:0x81a0d10 @stack=[], @genspace=#<Proc:0x81a0cc0>, @nest=[0], @newline="\n",
@buf=#<PrettyPrint::Group:0x81a0c98 @group=0, @tail=0, @buf=[#<PrettyPrint::Gro
up:0x81a0ba8 @group=1, @tail=0, @... -
NEWS for Ruby 3
. 0 . 0 (114.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...ror or different behavior. 14183
* Procs accepting a single rest argument and keywords are no longer
subject to autosplatting. This now matches the behavior of Procs
accepting a single rest argument and no keywords.
16166
//emlist[][ruby]{
pr = proc{|*a, **kw| [a, kw]}
pr.call([1])......[[[1]], {}]
pr.call([1, {a: 1}])
# 2.7 => [[1], {:a=>1}] # and deprecation warning
# 3.0 => a=>1}, {}]
//}
* Arguments forwarding (`...`) now supports leading arguments.
16378
//emlist{
def method_missing(meth, ...)
send(:"do_#{meth}", ...)
end
//}
* Pattern matching (`case/in`) is......wait(io, events, timeout)` in a non-blocking execution context. 16786
* Kernel
* Kernel#clone when called with the `freeze: false` keyword will call `#initialize_clone` with the `freeze: false` keyword. 14266
* Kernel#clone when called with the `freeze: true` keyword will call `#initialize... -
NEWS for Ruby 2
. 5 . 0 (60.0) -
NEWS for Ruby 2.5.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...黙の to_s 呼び出しにも refinements が影響するようになりました 13812
=== 組み込みクラスの更新
* Array
* Array#append を追加 12746
* Array#prepend を追加 12746
* Data
* 非推奨になりました。C拡張のベースクラスでしたが、Ruby......r.sqrt を追加 13219
* Kernel
* Object#yield_self を追加 6721
* Kernel.#pp をrequireなしで使えるようにしました 14123
* Kernel.#warn :uplevel というキーワード引数を追加しました 12882
* Method
* Method#=== は Proc#===と同じようにMetho......くなりました。
coerceがnilを返す場合、変換は不可能です。7688
* Process
* getrusage(2) が存在する場合 Process.#times の精度を改良しました 11952
* Process.last_status を追加。$? と同じです 14043
* Range
* Range.new no longer hide... -
irb (54.0)
-
irb は Interactive Ruby の略です。 irb を使うと、Ruby の式を標準入力から簡単に入力・実行することができます。
...f[:PROMPT_MODE] = :MY_PROMPT
PROMPT_I, PROMPT_S, PROMPT_C にはフォーマット文字列を指定します。
フォーマット文字列では Kernel.#printf のように
「%」を用いた記法が使えます。
フォーマット文字列で使用可能な記法は以下の通りです。......す。
そこで、IRB.conf[:IRB_RC] を使う方法を紹介します。
IRB.conf[:IRB_RC] に Proc オブジェクトを設定しておくと、
サブ irb が起動されるたびに、その Proc オブジェクトに
IRB::Context オブジェクトを渡して実行します。
これによっ......raw
出力結果を to_s したものを表示します。
: true, :p, :inspect
出力結果を inspect したものを表示します。
: :pp, :pretty_inspect
出力結果を pretty_inspect したものを表示します。
: :yaml, :YAML
出力結果を YAML 形式にしたもの...