るりまサーチ

最速Rubyリファレンスマニュアル検索!
392件ヒット [301-392件を表示] (0.135秒)

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

キーワード

検索結果

<< < ... 2 3 4 >>

Hash#select! -> Enumerator (144.0)

キーと値を引数としてブロックを評価した結果が真であるような要素を self に残します。

...素を self
に残します。

keep_if は常に self を返します。
select! はオブジェクトが変更された場合に self を、
されていない場合に nil を返します。

ブロックが与えられなかった場合は、自身と keep_if から生成した
Enumerator オブ...
...//emlist[例][ruby]{
h1 = {}
c = ("a".."g")
c.each_with_index {|e, i| h1[i] = e }

h2 = h1.dup
h1.select! # => #<Enumerator: {0=>"a", 1=>"b", 2=>"c", 3=>"d", 4=>"e", 5=>"f", 6=>"g"}:select!>

h1.select! { |k, v| k % 3 == 0 } # => {0=>"a", 3=>"d", 6=>"g"}
h1.select! { |k, v| true } # => ni...
...l
h2.keep_if { |k, v| k % 3 == 0 } # => {0=>"a", 3=>"d", 6=>"g"}
h2.keep_if { |k, v| true } # => {0=>"a", 3=>"d", 6=>"g"}
//}

@see Hash#select, Hash#delete_if, Hash#reject!...

Hash#<(other) -> bool (130.0)

self が other のサブセットである場合に真を返します。

...
self
が other のサブセットである場合に真を返します。

@param other 自身と比較したい Hash オブジェクトを指定します。

//emlist[例][ruby]{
h1 = {a:1, b:2}
h2 = {a:1, b:2, c:3}
h1 < h2 # => true
h2 < h1 # => false
h1 < h1 # => false
//}

@see Hash#<=,...
... Hash#>=, Hash#>...

Hash#<=(other) -> bool (130.0)

self が other のサブセットか同じである場合に真を返します。

...
self
が other のサブセットか同じである場合に真を返します。

@param other 自身と比較したい Hash オブジェクトを指定します。

//emlist[例][ruby]{
h1 = {a:1, b:2}
h2 = {a:1, b:2, c:3}
h1 <= h2 # => true
h2 <= h1 # => false
h1 <= h1 # => true
//}

@see...
...Hash#<, Hash#>=, Hash#>...

Hash#>(other) -> bool (130.0)

other が self のサブセットである場合に真を返します。

...r self のサブセットである場合に真を返します。

@param other 自身と比較したい Hash オブジェクトを指定します。

//emlist[例][ruby]{
h1 = {a:1, b:2}
h2 = {a:1, b:2, c:3}
h1 > h2 # => false
h2 > h1 # => true
h1 > h1 # => false
//}

@see Hash#<=, Hash...
...#<, Hash#>=...

Hash#>=(other) -> bool (130.0)

other が self のサブセットか同じである場合に真を返します。

...er self のサブセットか同じである場合に真を返します。

@param other 自身と比較したい Hash オブジェクトを指定します。

//emlist[例][ruby]{
h1 = {a:1, b:2}
h2 = {a:1, b:2, c:3}
h1 >= h2 # => false
h2 >= h1 # => true
h1 >= h1 # => true
//}

@see Hash...
...#<=, Hash#<, Hash#>...

絞り込み条件を変える

Hash#equal?(other) -> bool (130.0)

指定された other が self 自身である場合のみ真を返します。

...指定された other self 自身である場合のみ真を返します。

@param other 自身と比較したい Hash オブジェクトを指定します。

//emlist[例][ruby]{
p({}.equal?({})) #=> false
a = {}
p a.equal?(a) #=> true
//}

@see Hash#==...

Hash#each -> Enumerator (122.0)

ハッシュのキーと値を引数としてブロックを評価します。

...場合 self を、
無しで呼ばれた場合 Enumerator を返します。

each_pair は each のエイリアスです。

//emlist[例][ruby]{
{:a=>1, :b=>2}.each {|a| p a}
#=> [:a, 1]
# [:b, 2]

{:a=>1, :b=>2}.each {|k, v| p [k, v]}
#=> [:a, 1]
# [:b, 2]

p({:a=>1, :b=>2}.each_pair) # => #...
...<Enumerator: {:a=>1, :b=>2}:each_pair>
//}

@see Hash#each_key,Hash#each_value...

Hash#each_key -> Enumerator (121.0)

ハッシュのキーを引数としてブロックを評価します。

...れた順です。
ブロック付きの場合selfを、
無しで呼ばれた場合Enumeratorを返します。

//emlist[例][ruby]{
{:a=>1, :b=>2}.each_key {|k| p k}
#=> :a
# :b

p({:a=>1, :b=>2}.each_key) # => #<Enumerator: {:a=>1, :b=>2}:each_key>
//}

@see Hash#each_pair,Hash#each_value...

Hash#each_value -> Enumerator (121.0)

ハッシュの値を引数としてブロックを評価します。

...た順です。
ブロック付きの場合selfを、
無しで呼ばれた場合 Enumerator を返します。

//emlist[例][ruby]{
{:a=>1, :b=>2}.each_value {|v| p v}
#=> 1
# 2

p({:a=>1, :b=>2}.each_value) # => #<Enumerator: {:a=>1, :b=>2}:each_value>
//}

@see Hash#each_pair,Hash#each_key...
<< < ... 2 3 4 >>