るりまサーチ

最速Rubyリファレンスマニュアル検索!
851件ヒット [1-100件を表示] (0.027秒)
トップページ > クエリ:arg[x] > クエリ:Hash[x]

別のキーワード

  1. _builtin arg
  2. etc sc_arg_max
  3. mkmf arg_config
  4. float arg
  5. numeric arg

クラス

モジュール

検索結果

<< 1 2 3 ... > >>

Hash#[](key) -> object | nil (21072.0)

key に関連づけられた値を返します。

...る必要が
ある場合は Hash#fetch または Hash#key? を使ってください。

@param key 探索するキーを指定します。

//emlist[例][ruby]{
h = {:ab => "some" , :cd => "all"}
p h[:ab] #=> "some"
p h[:ef] #=> nil

h1 = Hash.new("default value")
p h1[:non]...
...#=> "default value"

h2 = Hash.new {|*arg| arg}
p h2[:non] #=> [{}, :non]
//}

@see Hash.new, Hash#fetch,Hash#values_at,Hash#key?, Hash#default, Hash#default_proc...

Hash#shift -> [object, object] | nil (21036.0)

ハッシュからキーが追加された順で先頭の要素をひとつ取り除き、 [key, value]という配列として返します。

...取り除かれた残りのハッシュに変更されます。

Ruby 3.2以前は、ハッシュが空の場合、デフォルト値(Hash#defaultまたはHash#default_procのブロックの値か、どちらもnilならばnil)
を返します(このとき、[key,value] という形式の値を...
...#=> [:cd, "all"]
p h #=> {}
p h.shift #=> nil

h1 = Hash.new("default value")
p h1 #=> {}
p h1.shift #=> "default value"

h2 = Hash.new {|*arg| arg}
p h2 #=> {}
p h2.shift #=> [{}, nil]
//}


@see Arra...
...#=> [:cd, "all"]
p h #=> {}
p h.shift #=> nil

h1 = Hash.new("default value")
p h1 #=> {}
p h1.shift #=> nil

h2 = Hash.new {|*arg| arg}
p h2 #=> {}
p h2.shift #=> nil
//}


@see Array#shift...

Kernel.#Hash(arg) -> Hash (18397.0)

引数 arg で指定したオブジェクトを to_hash メソッドを呼び出す事で Hash オブジェクトに変換します。nil か [] を指定した場合は空の Hash オブジェクトを返します。

...引数 arg で指定したオブジェクトを to_hash メソッドを呼び出す事で
Hash
オブジェクトに変換します。nil か [] を指定した場合は空の
Hash
オブジェクトを返します。

@param arg 変換対象のオブジェクトを指定します。

//emlist[例]...
...[ruby]{
Hash
([]) # => {}
Hash
(nil) # => {}
Hash
(key: :value) # => {:key => :value}
Hash
([1, 2, 3]) # => TypeError
//}

@raise TypeError 変換できないオブジェクトを指定した場合に発生します。...

Gem::Command.specific_extra_args_hash -> Hash (12302.0)

特別な追加引数へのアクセスを提供します。

特別な追加引数へのアクセスを提供します。

Rake::TaskArguments#to_hash -> Hash (9208.0)

パラメータ名と対応する値を格納したハッシュを返します。

...納したハッシュを返します。

//emlist[][ruby]{
# Rakefile での記載例とする

task default: :test_rake_app
task :test_rake_app do
arg
uments = Rake::TaskArguments.new(["name1", "name2"], ["value1", "value2"])
arg
uments.to_hash # => {:name1=>"value1", :name2=>"value2"}
end
//}...

絞り込み条件を変える

MiniTest::Unit#process_args(args = []) -> Hash (6301.0)

optparse を使ってコマンドライン引数を解析した結果を返します。

...optparse を使ってコマンドライン引数を解析した結果を返します。

@param args コマンドライン引数を指定します。

@see optparse...

static VALUE rb_f_hash(VALUE obj, VALUE arg) (6216.0)

Kernel.#Hash の実体です。

...Kernel.#Hash の実体です。...

OptionParser::Arguable#getopts(short_opt, *long_opt) -> Hash (3117.0)

指定された short_opt や long_opt に応じて自身をパースし、結果を Hash として返します。

...指定された short_opt や long_opt に応じて自身をパースし、結果を Hash として返します。

コマンドラインに - もしくは -- を指定した場合、それ以降の解析を行ないません。

@param short_opt ショートネームのオプション(-f や -fx)...
...Parser::ParseError のサブク
ラスの例外になります。

//emlist[t.rb][ruby]{
require 'optparse'
params = ARGV.getopts("ab:", "foo", "bar:", "bufsize:1024")
p params
//}

# 実行結果
$ ruby t.rb -b 1 --foo --bar xxx -- -a
{"bufsize"=>"1024", "a"=>fal...

Rake::TaskArguments#with_defaults(defaults) -> Hash (3113.0)

パラメータにデフォルト値をセットします。

...

task default: :test_rake_app
task :test_rake_app do
arg
uments = Rake::TaskArguments.new(["name1", "name2"], ["value1", "value2"])
arg
uments.to_hash # => {:name1=>"value1", :name2=>"value2"}
arg
uments.with_defaults({ default_key: "default_value"}) # =...
...> {:default_key=>"default_value", :name1=>"value1", :name2=>"value2"}
arg
uments.to_hash # => {:default_key=>"default_value", :name1=>"value1", :name2=>"value2"}
end
//}...

Rake::TaskArguments#each {|key, val| ... } -> Hash (3107.0)

自身に含まれるパラメータ名とそれに対応する値をブロックパラメータとしてブロックを評価します。

...自身に含まれるパラメータ名とそれに対応する値をブロックパラメータとしてブロックを評価します。


@see Hash#each...

絞り込み条件を変える

<< 1 2 3 ... > >>