204件ヒット
[1-100件を表示]
(0.063秒)
種類
- インスタンスメソッド (192)
- 特異メソッド (12)
検索結果
先頭5件
-
DBM
# to _ hash -> Hash (21107.0) -
self をハッシュに変換して返します。
...self をハッシュに変換して返します。
require 'dbm'
db1 = DBM.open('aaa.db', 0666, DBM::NEWDB)
db1[:a] = 'aaa'
db1[:b] = 'bbbbbb'
p db1.to_hash #=> {"a"=>"aaa", "b"=>"bbbbbb"}... -
SDBM
# to _ hash -> Hash (21107.0) -
self の各要素を格納したハッシュを返します。
...self の各要素を格納したハッシュを返します。
require 'sdbm'
db1 = SDBM.open('aaa.gdbm', 0666)
db1.clear
db1['a'] = 'aaa'
db1['b'] = 'bbb'
db1['c'] = 'ccc'
p db1.to_hash #=> {"a"=>"aaa", "b"=>"bbb", "c"=>"ccc"}... -
GDBM
# to _ hash -> Hash (21101.0) -
self の各要素を格納したハッシュを返します。
self の各要素を格納したハッシュを返します。 -
YAML
:: DBM # to _ hash -> Hash (21101.0) -
自身のキー、値をハッシュにしたものを返します。
自身のキー、値をハッシュにしたものを返します。 -
Rake
:: TaskArguments # with _ defaults(defaults) -> Hash (6212.0) -
パラメータにデフォルト値をセットします。
...ルト値をセットします。
@param defaults デフォルト値として使用するキーと値を格納したハッシュを指定します。
//emlist[][ruby]{
# Rakefile での記載例とする
task default: :test_rake_app
task :test_rake_app do
arguments = Rake::TaskArguments.new(["n......ments.to_hash # => {:name1=>"value1", :name2=>"value2"}
arguments.with_defaults({ default_key: "default_value"}) # => {:default_key=>"default_value", :name1=>"value1", :name2=>"value2"}
arguments.to_hash # => {:default......_key=>"default_value", :name1=>"value1", :name2=>"value2"}
end
//}... -
SDBM
# update(other) -> self (6154.0) -
self と other の内容をマージします。
...re 'sdbm'
db1 = SDBM.open('aaa.gdbm', 0666)
db1.clear
db1['a'] = 'aaa'
db1['b'] = 'bbb'
db1['c'] = 'ccc'
db2 = SDBM.open('bbb.gdbm', 0666)
db2.clear
db2['c'] = 'ccc'
db2['d'] = 'ddd'
hash = { 'x' => 'xxx', 'y' => 'yyy'}
p db1 #=> #<SDBM:0xb7d19554>
p db1.t......a"=>"aaa", "b"=>"bbb", "c"=>"ccc"}
p db1.update(db2) #=> #<SDBM:0xb7d19554>
p db1.to_hash #=> {"a"=>"aaa", "b"=>"bbb", "c"=>"ccc", "d"=>"ddd"}
p db1.update(hash) #=> #<SDBM:0xb7d19554>
p db1.to_hash #=> {"a"=>"aaa", "x"=>"xxx", "b"=>"bbb", "y"=>"yyy", "c"=>"ccc", "d"=>"ddd"}... -
Hash
# update(*others) -> self (3166.0) -
selfとothersのハッシュの内容を順番にマージ(統合)します。
...値を使います。
othersがハッシュではない場合、othersのメソッドto_hashを使って暗黙の変換を試みます。
@param others マージ用のハッシュまたはメソッド to_hash でハッシュに変換できるオブジェクトです。
@return マージ後のself......300 }
h3 = { "b" => 357, "d" => 400 }
h1.merge!(h2, h3) #=> {"a"=>100, "b"=>357, "c"=>300, "d"=>400}
h1 #=> {"a"=>100, "b"=>357, "c"=>300, "d"=>400}
//}
//emlist[][ruby]{
h1 = { "a" => 100, "b" => 200 }
h2 = { "b" => 246, "c" => 300 }
h3 = { "b" => 357, "d" => 400 }
h1.merge!(h2, h......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=>"a", 2=>"B", 3=>"C", 4=>"D"}
p foo #=> {1=>"a", 2=>"B", 3=>"C", 4=>"D"}
p foo.update(bar) {... -
Hash
# update(*others) {|key , self _ val , other _ val| . . . } -> self (3166.0) -
selfとothersのハッシュの内容を順番にマージ(統合)します。
...値を使います。
othersがハッシュではない場合、othersのメソッドto_hashを使って暗黙の変換を試みます。
@param others マージ用のハッシュまたはメソッド to_hash でハッシュに変換できるオブジェクトです。
@return マージ後のself......300 }
h3 = { "b" => 357, "d" => 400 }
h1.merge!(h2, h3) #=> {"a"=>100, "b"=>357, "c"=>300, "d"=>400}
h1 #=> {"a"=>100, "b"=>357, "c"=>300, "d"=>400}
//}
//emlist[][ruby]{
h1 = { "a" => 100, "b" => 200 }
h2 = { "b" => 246, "c" => 300 }
h3 = { "b" => 357, "d" => 400 }
h1.merge!(h2, h......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=>"a", 2=>"B", 3=>"C", 4=>"D"}
p foo #=> {1=>"a", 2=>"B", 3=>"C", 4=>"D"}
p foo.update(bar) {... -
Hash
# update(other) -> self (3130.0) -
selfとotherのハッシュの内容をマージ(統合)します。
...r の値を使います。
otherがハッシュではない場合、otherのメソッドto_hashを使って暗黙の変換を試みます。
@param other マージ用のハッシュまたはメソッド to_hash でハッシュに変換できるオブジェクトです。
@return マージ後のsel......> 'B', 3 => 'C', 4 => 'D'}
p foo.update(bar) #=> {1=>"a", 2=>"B", 3=>"C", 4=>"D"}
p foo #=> {1=>"a", 2=>"B", 3=>"C", 4=>"D"}
p foo.update(bar) {|key, foo_val, bar_val| foo_val + bar_val } # => {1=>"a", 2=>"BB", 3=>"CC", 4=>"DD"}
p foo # => {1=>"a", 2=>"BB", 3=>"CC", 4=>"DD"}
//}
@see Hash#merge... -
Hash
# update(other) {|key , self _ val , other _ val| . . . } -> self (3130.0) -
selfとotherのハッシュの内容をマージ(統合)します。
...r の値を使います。
otherがハッシュではない場合、otherのメソッドto_hashを使って暗黙の変換を試みます。
@param other マージ用のハッシュまたはメソッド to_hash でハッシュに変換できるオブジェクトです。
@return マージ後のsel......> 'B', 3 => 'C', 4 => 'D'}
p foo.update(bar) #=> {1=>"a", 2=>"B", 3=>"C", 4=>"D"}
p foo #=> {1=>"a", 2=>"B", 3=>"C", 4=>"D"}
p foo.update(bar) {|key, foo_val, bar_val| foo_val + bar_val } # => {1=>"a", 2=>"BB", 3=>"CC", 4=>"DD"}
p foo # => {1=>"a", 2=>"BB", 3=>"CC", 4=>"DD"}
//}
@see Hash#merge... -
SDBM
# replace(other) -> self (3048.0) -
self の内容を other の内容で置き換えます。
...require 'sdbm'
db1 = SDBM.open('aaa.gdbm', 0666)
db1['a'] = 'aaa'
db1['b'] = 'bbb'
db1['c'] = 'ccc'
db2 = SDBM.open('bbb.gdbm', 0666)
db2['c'] = 'ccc'
db2['d'] = 'ddd'
hash = { 'x' => 'xxx', 'y' => 'yyy'}
p db1 #=> #<SDBM:0xb7c304d0>
p db1.to_hash #=>......{"a"=>"aaa", "b"=>"bbb", "c"=>"ccc"}
p db1.replace(db2) #=> #<SDBM:0xb7c304d0>
p db1.to_hash #=> {"c"=>"ccc", "d"=>"ddd"}
p db1.replace(hash) #=> #<SDBM:0xb7c304d0>
p db1.to_hash #=> {"x"=>"xxx", "y"=>"yyy"}...