種類
- 文書 (59)
- インスタンスメソッド (20)
ライブラリ
- ビルトイン (20)
クラス
- Hash (20)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) -
NEWS for Ruby 2
. 3 . 0 (9) -
NEWS for Ruby 2
. 4 . 0 (8) -
NEWS for Ruby 2
. 7 . 0 (5) -
NEWS for Ruby 3
. 0 . 0 (4) -
default
_ proc= (11) -
ruby 1
. 9 feature (11) - メソッド呼び出し(super・ブロック付き・yield) (11)
検索結果
先頭5件
-
Hash
# to _ proc -> Proc (27101.0) -
self のキーに対応する値を返す Proc オブジェクトを返します。
self のキーに対応する値を返す Proc オブジェクトを返します。
//emlist[][ruby]{
h = {1 => 10, 2 => 20, 3 => 30}
[1, 2, 3].map(&h) # => [10, 20, 30]
//} -
Hash
# default _ proc=(pr) (9048.0) -
ハッシュのデフォルト値を返す Proc オブジェクトを 変更します。
...前のデフォルトは値(Hash#default)の場合も
Proc の場合(Hash#default_proc)でも上書きされます。
引数には to_proc で Proc オブジェクトに変換できる
オブジェクトも受け付けます。
nil を指定した場合は現在の Hash#default_proc をクリア......します。
@param pr デフォルト値を返す手続きオブジェクト
//emlist[例][ruby]{
h = {}
h.default_proc = proc do |hash, key|
hash[key] = case
when (key % 15).zero?
"FizzBuzz"
when (key % 5).zero?
"Buzz"......2] # => 2
p h[3] # => "Fizz"
p h[5] # => "Buzz"
p h[15] # => "FizzBuzz"
h.default_proc = nil
p h[16] # => nil
# default_proc が nil になったので `16=>16 が追加されていない`
p h # => {1=>1, 2=>2, 3=>"Fizz", 5=>"Buzz", 15=>"FizzBuzz"}
//}
@see Hash#default_proc, Hash#default... -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (162.0) -
1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))
...ッド引数の & 修飾|メソッド呼び出し/イテレータ>)) [compat]
: ((<Proc#to_proc|Proc/to_proc>)) [new]
メソッドに渡す引数に & を修飾した場合、渡すオブジェクトが to_proc を
持っていればそれを実行し、その結果をブロックとして渡......すようになりまし
た。以前は、& 修飾できるのは Proc, Method オブジェクト限定でした。
これに伴い Proc#to_proc が追加されました。
: 終了ステータス [compat]
raise SystemExit したときに終了ステータス 1 で終了するようにな......((<ENV/ENV.clear>)) [new]
: ((<ENV/ENV.shift>)) [new]
: ((<ENV/ENV.invert>)) [new]
: ((<ENV/ENV.replace>)) [new]
: ((<ENV/ENV.update>)) [new]
((<Hash>)) との互換性のために定義されました。
=== Enumerable
: ((<Enumerable#partition|Enumerable/partition>)) [new]
追加
: ((<Enu... -
ruby 1
. 9 feature (114.0) -
ruby 1.9 feature ruby version 1.9.0 は開発版です。 以下にあげる機能は将来削除されたり互換性のない仕様変更がなされるかもしれません。 1.9.1 以降は安定版です。 バグ修正がメインになります。
...: digest.rb
: Digest::Base.file
=== 2006-09-13
: Hash#compare_by_identity
: Hash#compare_by_identity?
: Hash#identical
: Hash#identical?
=== 2006-09-12
: Hash#compare_by_identity
: Hash#compare_by_identity?
=== 2006-09-11
: Hash#identical
: Hash#identical?
=== 2006-08-31
: Array#shuffle
: Ar......削除
=== 2006-06-11
: __callee__ [new]
: __method__ [new]
((<URL:http://www.dm4lab.to/~usa/ruby/d/200606a.html#id20060610_P1_7>))
: Symbol#to_proc
=== 2006-06-10
* 新機能
: BasicObject が導入されました [new]
: local という visibility および Module#local, Module#local_m......: いくらか obsolete な構文が除去されました
: Values はなくなりました
* その他
: 文字列のハッシュに FNV-1a hash を使用するようになりました
: Regexp#initialize でリテラルの正規表現を変更できなくなりました
: $SAFE=4 で... -
NEWS for Ruby 3
. 0 . 0 (72.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...ob and Dir.[] now sort the results by default, and accept the `sort:` keyword option. 8709
* ENV
* ENV.except has been added, which returns a hash excluding the given keys and their values. 15822
* Windows: Read ENV names and values as UTF-8 encoded Strings 12650
* Encoding
* Added......cant overhead to major collections, so please test first! 17176
* Hash
* Hash#transform_keys and Hash#transform_keys! now accept a hash that maps keys to new keys. 16274
* Hash#except has been added, which returns a hash excluding the given keys and their values. 15822
* IO
* IO#n......#sub
* String#succ / String#next
* String#swapcase
* String#tr
* String#tr_s
* String#upcase
* Symbol
* Symbol#to_proc now returns a lambda Proc. 16260
* Symbol#name has been added, which returns the name of the symbol if it is named. The returned string is... -
NEWS for Ruby 2
. 3 . 0 (66.0) -
NEWS for Ruby 2.3.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...応する File::TMPFILE(File::Constants::TMPFILE) を追加
* Hash
* Hash#fetch_values を追加
10017
* Hash#dig を追加
11643
* Hash#<=, Hash#<, Hash#>=, Hash#> を追加
10984
* Hash#to_proc を追加
11653
* IO
* 新しいフラグ File::SHARE_......に 0 を返していましたが、
BY_HANDLE_FILE_INFORMATION.nFileIndexHigh/Low を返すようになりました。
11216
* Hash
* Hash#inspect はその要素の文字列が Encoding.default_external と
互換性のないエンコーディングであっても例外が... -
メソッド呼び出し(super・ブロック付き・yield) (42.0)
-
メソッド呼び出し(super・ブロック付き・yield) * super * block * yield * block_arg * numbered_parameters * call_method
...シュ式の解説(d:spec/literal#hash)にも書かれている通り、
メソッド呼出の末尾にHashを渡す場合は {, } を省略することができます。
これを用いることでキーワード引数を渡すことができます。
この Hash はd:spec/def#methodで解説され......ている
# => 1
# 2
# 3
//}
to_proc メソッドを持つオブジェクトならば、`&'
修飾した引数として渡すことができます。デフォルトで Proc、Method オブジェ
クトは共に to_proc メソッドを持ちます。to_proc はメソッド呼び出し時に実......行され、Proc オブジェクトを返すことが期待されます。
//emlist[][ruby]{
class Foo
def to_proc
Proc.new {|v| p v}
end
end
[1,2,3].each(&Foo.new)
# => 1
# 2
# 3
//}
ブロック付きメソッドの戻り値は、通常のメソッドと同様ですが、ブロ... -
NEWS for Ruby 2
. 4 . 0 (36.0) -
NEWS for Ruby 2.4.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...い。
== 2.3.0 以降の変更
=== 言語仕様の変更
* 条件式での多重代入ができるようになりました 10617
* Symbol#to_proc でメソッド呼び出し元での Refinements が有効になりました 9451
* Object#send や BasicObject#__send__ でメソッドを呼......になりました。
half には :even, :up, :down が指定可能です。 12548 12958 12953
* Hash
* Hash#compact, Hash#compact! を追加 11818
* Hash#transform_values Hash#transform_values! を追加 12512
* Integer
* Fixnum と Bignum は Integer に統合されまし... -
NEWS for Ruby 2
. 7 . 0 (18.0) -
NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...zy ではない enumerator を生成する
Enumerator::Lazy#eagerメソッドが追加されました。 15901
* Enumerator::Yielder#to_procメソッドが追加され、Yielder オブジェクトを
直接他のメソッドのブロック引数として渡せるようになり......のプラットフォームでrealpath(3)を使います。
これは大幅にパフォーマンスを改善します。 15797
* Hash
* 小さいHashオブジェクトのデータ構造が変わりました。 15602
* Monitor
* MonitorクラスがC拡張になりました。 1625...