るりまサーチ

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

別のキーワード

  1. openssl p
  2. openssl p=
  3. fileutils mkdir_p
  4. kernel p
  5. rsa p

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 > >>

Hash#merge(*others) -> Hash (18199.0)

selfとothersのハッシュの内容を順番にマージ(統合)した結果を返します。 デフォルト値はselfの設定のままです。

...場合、othersのメソッドto_hashを使って暗黙の変換を試みます。

@
param others マージ用のハッシュまたはメソッド to_hash でハッシュに変換できるオブジェクトです。
@
return マージした結果を返します

//emlist[][ruby]{
h1 = { "a" => 100, "...
...#=> {"a"=>100, "b"=>200}
h1.merge(h2) #=> {"a"=>100, "b"=>246, "c"=>300}
h1.merge(h2, h3) #=> {"a"=>100, "b"=>357, "c"=>300, "d"=>400}
h1.merge(h2) {|key, oldval, newval| newval - oldval}
#=> {"a"=>100, "b"=>46, "c"=>300}
h1.merge(h2, h3) {|key, oldval, newval| newv...
...=> 'c'}
bar = {2 => 'B', 3 => 'C', 4 => 'D'}

p
foo.merge(bar)
# => {1=>"a", 2=>"B", 3=>"C", 4=>"D"}
p
foo # => {1=>"a", 2=>"b", 3=>"c"}

p
foo.merge!(bar) {|key, foo_val, bar_val| foo_val + bar_val }
# => {1=>"a", 2=>"bB", 3=>"cC", 4=>"D"}
p
foo # => {1=>"a", 2=>"bB", 3=>"cC", 4=>"D...

Hash#merge(*others) {|key, self_val, other_val| ... } -> Hash (18199.0)

selfとothersのハッシュの内容を順番にマージ(統合)した結果を返します。 デフォルト値はselfの設定のままです。

...場合、othersのメソッドto_hashを使って暗黙の変換を試みます。

@
param others マージ用のハッシュまたはメソッド to_hash でハッシュに変換できるオブジェクトです。
@
return マージした結果を返します

//emlist[][ruby]{
h1 = { "a" => 100, "...
...#=> {"a"=>100, "b"=>200}
h1.merge(h2) #=> {"a"=>100, "b"=>246, "c"=>300}
h1.merge(h2, h3) #=> {"a"=>100, "b"=>357, "c"=>300, "d"=>400}
h1.merge(h2) {|key, oldval, newval| newval - oldval}
#=> {"a"=>100, "b"=>46, "c"=>300}
h1.merge(h2, h3) {|key, oldval, newval| newv...
...=> 'c'}
bar = {2 => 'B', 3 => 'C', 4 => 'D'}

p
foo.merge(bar)
# => {1=>"a", 2=>"B", 3=>"C", 4=>"D"}
p
foo # => {1=>"a", 2=>"b", 3=>"c"}

p
foo.merge!(bar) {|key, foo_val, bar_val| foo_val + bar_val }
# => {1=>"a", 2=>"bB", 3=>"cC", 4=>"D"}
p
foo # => {1=>"a", 2=>"bB", 3=>"cC", 4=>"D...

Hash#merge(other) -> Hash (18187.0)

selfとotherのハッシュの内容をマージ(統合)した結果を返します。デフォルト値はselfの設定のままです。

...試みます。

@
param other マージ用のハッシュまたはメソッド to_hash でハッシュに変換できるオブジェクトです。
@
return マージした結果を返します

//emlist[][ruby]{
h1 = { "a" => 100, "b" => 200 }
h2 = { "b" => 254, "c" => 300 }
h1.merge() # => {"a"...
...}
h1.merge(h2) # => {"a"=>100, "b"=>254, "c"=>300}
h1.merge(h2){|key, oldval, newval| newval - oldval}
# => {"a"=>100, "b"=>54, "c"=>300}
h1 # => {"a"=>100, "b"=>200}
//}

//emlist[][ruby]{
foo = {1 => 'a', 2 => 'b', 3 => 'c'}
bar = {2 => 'B', 3 => 'C', 4 => 'D'}

p
foo...
...>"D"}
p
foo # => {1=>"a", 2=>"b", 3=>"c"}

p
foo.merge!(bar) {|key, foo_val, bar_val| foo_val + bar_val }
# => {1=>"a", 2=>"bB", 3=>"cC", 4=>"D"}
p
foo # => {1=>"a", 2=>"bB", 3=>"cC", 4=>"D"}
//}

//emlist[][ruby]{
class Foo
def to_hash
{:Australia => 'Sydney',
:France => 'Paris'...

Hash#merge(other) {|key, self_val, other_val| ... } -> Hash (18187.0)

selfとotherのハッシュの内容をマージ(統合)した結果を返します。デフォルト値はselfの設定のままです。

...試みます。

@
param other マージ用のハッシュまたはメソッド to_hash でハッシュに変換できるオブジェクトです。
@
return マージした結果を返します

//emlist[][ruby]{
h1 = { "a" => 100, "b" => 200 }
h2 = { "b" => 254, "c" => 300 }
h1.merge() # => {"a"...
...}
h1.merge(h2) # => {"a"=>100, "b"=>254, "c"=>300}
h1.merge(h2){|key, oldval, newval| newval - oldval}
# => {"a"=>100, "b"=>54, "c"=>300}
h1 # => {"a"=>100, "b"=>200}
//}

//emlist[][ruby]{
foo = {1 => 'a', 2 => 'b', 3 => 'c'}
bar = {2 => 'B', 3 => 'C', 4 => 'D'}

p
foo...
...>"D"}
p
foo # => {1=>"a", 2=>"b", 3=>"c"}

p
foo.merge!(bar) {|key, foo_val, bar_val| foo_val + bar_val }
# => {1=>"a", 2=>"bB", 3=>"cC", 4=>"D"}
p
foo # => {1=>"a", 2=>"bB", 3=>"cC", 4=>"D"}
//}

//emlist[][ruby]{
class Foo
def to_hash
{:Australia => 'Sydney',
:France => 'Paris'...

Set#merge(enum) -> self (18126.0)

元の集合に enum で与えられた要素を追加します。

...ます。

@
param enum 追加対象の要素を格納したオブジェクトを指定します。
@
raise ArgumentError 引数 enum に each メソッドが定義されていない場合に
発生します。

//emlist[][ruby]{
require 'set'
set = Set[10, 20]
set.merge([10, 30])
p
set # => #<...
...があります。

@
param enum 追加対象の要素を格納したオブジェクトを指定します。
@
raise ArgumentError 引数 enum に each メソッドが定義されていない場合に
発生します。

//emlist[][ruby]{
set = Set[10, 20]
set.merge([10, 30])
p
set # => #<Set:...

絞り込み条件を変える

JSON::State#merge(options = {}) -> self (15214.0)

与えられたハッシュで自身を設定します。

...で自身を設定します。

オプションで使用するハッシュのキーについては JSON::State.new を参照してください。

@
param options このオブジェクトの設定をするためのハッシュを指定します。

//emlist[例][ruby]{
require "json"

json_state = JS...
...y1: "value1", key2: "value2"}, json_state)
# => "{\t\"key1\":\"value1\",\t\"key2\":\"value2\"}"

json_state.configure(indent: " ")
json_state.indent # => " "
JSON.generate({key1: "value1", key2: "value2"}, json_state)
# => "{ \"key1\":\"value1\", \"key2\":\"value2\"}"
//}

@
see JSON::State.new...

URI::Generic#merge(rel) -> URI::Generic (15180.0)

自身と与えられたパス rel を連結した新しい URI オブジェクトを生成して返します。

...は URI.parse(rel) によって、URI に変換してから連結します。


@
param rel 連結したいパスを文字列か URI オブジェクトで与えます。

例:
require 'uri'
p
URI.parse('http://example.com/') + '/foo/bar.html'
#=> #<URI::HTTP:0x201001c0 URL:http://example.com/fo...
...('http://a/b/c/d;p?q').merge('?y') #=> #<URI::HTTP:0xb7ca2e2c URL:http://a/b/c/d;p?y>
URI('http://a/b/c/d;p?q').merge('/./g') #=> #<URI::HTTP:0xb7ca2738 URL:http://a/g>
URI('http://a/b/c/d;p?q').merge('/../g') #=> #<URI::HTTP:0xb7ca2008 URL:http://a/g>
URI('http://a...
.../b/c/d;p?q').merge('../../../g') #=> #<URI::HTTP:0xb7ca1888 URL:http://a/g>
URI('http://a/b/c/d;p?q').merge('../../../../g') #=> #<URI::HTTP:0xb7ca10a4 URL:http://a/g>...

Gem::Command#merge_options(new_options) -> Hash (12308.0)

与えられたオプションとデフォルトのオプションをマージします。 しかし、新しいオプションに同一のキーがあってもデフォルトのオプションは変更されません。

...オプションとデフォルトのオプションをマージします。
しかし、新しいオプションに同一のキーがあってもデフォルトのオプションは変更されません。

@
param new_options 新しいコマンドオプションをハッシュで指定します。...

Hash#merge!(*others) -> self (6175.0)

selfとothersのハッシュの内容を順番にマージ(統合)します。

...黙の変換を試みます。

@
param others マージ用のハッシュまたはメソッド to_hash でハッシュに変換できるオブジェクトです。
@
return マージ後のselfを返します。

//emlist[][ruby]{
h1 = { "a" => 100, "b" => 200 }
h1.merge! #=> {"a"=>100, "b"=>...
...2 = { "b" => 246, "c" => 300 }
h1.merge!(h2) #=> {"a"=>100, "b"=>246, "c"=>300}
h1 #=> {"a"=>100, "b"=>246, "c"=>300}
//}

//emlist[][ruby]{
h1 = { "a" => 100, "b" => 200 }
h2 = { "b" => 246, "c" => 300 }
h3 = { "b" => 357, "d" => 400 }
h1.merge!(h2, h3) #=> {"a"=>100, "b"=>357...
..."d" => 400 }
h1.merge!(h2, h3) {|key, v1, v2| v1 }
#=> {"a"=>100, "b"=>200, "c"=>300, "d"=>400}
h1 #=> {"a"=>100, "b"=>200, "c"=>300, "d"=>400}
//}

//emlist[][ruby]{
foo = {1 => 'a', 2 => 'b', 3 => 'c'}
bar = {2 => 'B', 3 => 'C', 4 => 'D'}

p
foo.update(bar) #=> {...

Hash#merge!(*others) {|key, self_val, other_val| ... } -> self (6175.0)

selfとothersのハッシュの内容を順番にマージ(統合)します。

...黙の変換を試みます。

@
param others マージ用のハッシュまたはメソッド to_hash でハッシュに変換できるオブジェクトです。
@
return マージ後のselfを返します。

//emlist[][ruby]{
h1 = { "a" => 100, "b" => 200 }
h1.merge! #=> {"a"=>100, "b"=>...
...2 = { "b" => 246, "c" => 300 }
h1.merge!(h2) #=> {"a"=>100, "b"=>246, "c"=>300}
h1 #=> {"a"=>100, "b"=>246, "c"=>300}
//}

//emlist[][ruby]{
h1 = { "a" => 100, "b" => 200 }
h2 = { "b" => 246, "c" => 300 }
h3 = { "b" => 357, "d" => 400 }
h1.merge!(h2, h3) #=> {"a"=>100, "b"=>357...
..."d" => 400 }
h1.merge!(h2, h3) {|key, v1, v2| v1 }
#=> {"a"=>100, "b"=>200, "c"=>300, "d"=>400}
h1 #=> {"a"=>100, "b"=>200, "c"=>300, "d"=>400}
//}

//emlist[][ruby]{
foo = {1 => 'a', 2 => 'b', 3 => 'c'}
bar = {2 => 'B', 3 => 'C', 4 => 'D'}

p
foo.update(bar) #=> {...

絞り込み条件を変える

Hash#update(*others) -> self (6175.0)

selfとothersのハッシュの内容を順番にマージ(統合)します。

...黙の変換を試みます。

@
param others マージ用のハッシュまたはメソッド to_hash でハッシュに変換できるオブジェクトです。
@
return マージ後のselfを返します。

//emlist[][ruby]{
h1 = { "a" => 100, "b" => 200 }
h1.merge! #=> {"a"=>100, "b"=>...
...2 = { "b" => 246, "c" => 300 }
h1.merge!(h2) #=> {"a"=>100, "b"=>246, "c"=>300}
h1 #=> {"a"=>100, "b"=>246, "c"=>300}
//}

//emlist[][ruby]{
h1 = { "a" => 100, "b" => 200 }
h2 = { "b" => 246, "c" => 300 }
h3 = { "b" => 357, "d" => 400 }
h1.merge!(h2, h3) #=> {"a"=>100, "b"=>357...
..."d" => 400 }
h1.merge!(h2, h3) {|key, v1, v2| v1 }
#=> {"a"=>100, "b"=>200, "c"=>300, "d"=>400}
h1 #=> {"a"=>100, "b"=>200, "c"=>300, "d"=>400}
//}

//emlist[][ruby]{
foo = {1 => 'a', 2 => 'b', 3 => 'c'}
bar = {2 => 'B', 3 => 'C', 4 => 'D'}

p
foo.update(bar) #=> {...

Hash#update(*others) {|key, self_val, other_val| ... } -> self (6175.0)

selfとothersのハッシュの内容を順番にマージ(統合)します。

...黙の変換を試みます。

@
param others マージ用のハッシュまたはメソッド to_hash でハッシュに変換できるオブジェクトです。
@
return マージ後のselfを返します。

//emlist[][ruby]{
h1 = { "a" => 100, "b" => 200 }
h1.merge! #=> {"a"=>100, "b"=>...
...2 = { "b" => 246, "c" => 300 }
h1.merge!(h2) #=> {"a"=>100, "b"=>246, "c"=>300}
h1 #=> {"a"=>100, "b"=>246, "c"=>300}
//}

//emlist[][ruby]{
h1 = { "a" => 100, "b" => 200 }
h2 = { "b" => 246, "c" => 300 }
h3 = { "b" => 357, "d" => 400 }
h1.merge!(h2, h3) #=> {"a"=>100, "b"=>357...
..."d" => 400 }
h1.merge!(h2, h3) {|key, v1, v2| v1 }
#=> {"a"=>100, "b"=>200, "c"=>300, "d"=>400}
h1 #=> {"a"=>100, "b"=>200, "c"=>300, "d"=>400}
//}

//emlist[][ruby]{
foo = {1 => 'a', 2 => 'b', 3 => 'c'}
bar = {2 => 'B', 3 => 'C', 4 => 'D'}

p
foo.update(bar) #=> {...
<< 1 2 > >>