500件ヒット
[1-100件を表示]
(0.140秒)
別のキーワード
クラス
- Hash (84)
- Integer (24)
- Module (12)
- OptionParser (84)
- Pathname (12)
-
Rake
:: FileList (36) -
Rake
:: InvocationChain (24) -
Rake
:: TaskArguments (36) -
Ripper
:: Filter (12) - String (36)
- Thread (8)
- ThreadGroup (12)
モジュール
- Kernel (12)
-
Net
:: HTTPHeader (36) -
Rake
:: TaskManager (72)
キーワード
- == (12)
- [] (36)
- add (12)
- append (12)
-
arg
_ config (12) - chr (24)
-
default
_ argv (12) -
define
_ task (12) - encode (36)
-
excluded
_ from _ list? (12) - fetch (80)
- getopts (24)
- import (12)
-
in
_ namespace (12) - intern (12)
- lookup (12)
- member? (12)
-
new
_ scope (12) - order! (24)
- parse (12)
- parse! (12)
- permute! (12)
- public (12)
-
synthesize
_ file _ task (12) -
values
_ at (12) -
with
_ defaults (12)
検索結果
先頭5件
-
Hash
# default -> object | nil (24505.0) -
ハッシュのデフォルト値を返します。
...には 2 番目の形式か Hash#default_proc を使ってください。
2 番目の形式はハッシュがデフォルト値としてブロックを持つ場合に、
self と引数 key をブロックに渡して評価し、その結果を返します。
@param key デフォルトのブロッ......emlist[例][ruby]{
h = Hash.new("default")
p h.default #=> "default"
p h.default(:some) #=> "default"
p h #=>{}
h = Hash.new{|hash, key| hash[key] ="default" }
p h.default #=> nil
p h.default(:some) #=> "default"
p h #=> {:some=>"default"}
h = Hash.new
p h.default......#=> nil
p h.default(:some) #=> nil
p h #=> {}
//}
@see Hash#default=, Hash#default_proc... -
Hash
# default(key) -> object | nil (24405.0) -
ハッシュのデフォルト値を返します。
...には 2 番目の形式か Hash#default_proc を使ってください。
2 番目の形式はハッシュがデフォルト値としてブロックを持つ場合に、
self と引数 key をブロックに渡して評価し、その結果を返します。
@param key デフォルトのブロッ......emlist[例][ruby]{
h = Hash.new("default")
p h.default #=> "default"
p h.default(:some) #=> "default"
p h #=>{}
h = Hash.new{|hash, key| hash[key] ="default" }
p h.default #=> nil
p h.default(:some) #=> "default"
p h #=> {:some=>"default"}
h = Hash.new
p h.default......#=> nil
p h.default(:some) #=> nil
p h #=> {}
//}
@see Hash#default=, Hash#default_proc... -
Rake
:: TaskArguments # with _ defaults(defaults) -> Hash (12455.0) -
パラメータにデフォルト値をセットします。
...ットします。
@param defaults デフォルト値として使用するキーと値を格納したハッシュを指定します。
//emlist[][ruby]{
# Rakefile での記載例とする
task default: :test_rake_app
task :test_rake_app do
arguments = Rake::TaskArguments.new(["name1", "name2"]......ents.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
//}... -
OptionParser
# default _ argv -> [String] (12344.0) -
自身がデフォルトでパースする引数を文字列の配列で返します。
...ます。
@param argv デフォルトでパースする文字列の配列を返します。
//emlist[例][ruby]{
require "optparse"
opts = OptionParser.new
# --hoo param1 --bar param2 をパラメーターに指定して実行
opts.default_argv # => ["--foo", "param1", "--bar", "param2"]
//}... -
Rake
:: TaskManager # define _ task(task _ class , *args) { . . . } -> Rake :: Task (9437.0) -
タスクを定義します。
...@param task_class タスククラスを指定します。
@param args タスクに渡すパラメータを指定します。
//emlist[][ruby]{
# Rakefile での記載例とする
task default: :test_rake_app
task :test_rake_app do
Rake.application.define_task(Rake::Task, :t) # => <Rake::Task t... -
Pathname
# expand _ path(default _ dir = & # 39; . & # 39;) -> Pathname (9426.0) -
Pathname.new(File.expand_path(self.to_s, *args)) と同じです。
...Pathname.new(File.expand_path(self.to_s, *args)) と同じです。
@param default_dir self が相対パスであれば default_dir を基準に展開されます。
//emlist[例][ruby]{
require "pathname"
path = Pathname("testfile")
Pathname.pwd # => #<Pathname:/path/to>
path.expand_......path # => #<Pathname:/path/to/testfile>
path.expand_path("../") # => #<Pathname:/path/testfile>
//}
@see File.expand_path... -
Rake
:: TaskManager # synthesize _ file _ task(task _ name) -> Rake :: FileTask | nil (9219.0) -
与えられたタスク名をもとにファイルタスクを合成します。
...合成します。
@param task_name タスク名を指定します。
@return 与えられたタスク名と同名のファイルが存在する場合は、ファイルタスクを作成して返します。
そうでない場合は nil を返します。
@raise RuntimeError タスクを......。
//emlist[][ruby]{
# Rakefile での記載例とする
task default: :test_rake_app
task :test_rake_app do |task|
task.application.synthesize_file_task("sample_file") # => nil
IO.write("sample_file", "")
task.application.synthesize_file_task("sample_file") # => <Rake::FileTask sample_fil... -
Net
:: HTTPHeader # fetch(key , default) -> String (6416.0) -
key ヘッダフィールドを返します。
...ドを返します。
たとえばキー 'content-length' に対しては '2048'
のような文字列が得られます。キーが存在しなければ nil を返します。
該当するキーが登録されてい
ない時には、引数 default が与えられていればその値を、ブ......param key ヘッダフィール名を文字列で与えます。
@param default 該当するキーが登録されていない時の返り値を指定します。
@raise IndexError 引数defaultもブロックも与えられてない時、キーの探索に 失敗すると発生します。
//emlist......在する][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("user-agent") # => "Ruby"
//}
//emlist[例 key のみ指定。key が存在しない][ruby]{
require 'net/http'
begin
req.fetch("content-length")
rescue... -
Hash
# fetch(key , default) -> object (6366.0) -
key に関連づけられた値を返します。該当するキーが登録されてい ない時には、引数 default が与えられていればその値を、ブロッ クが与えられていればそのブロックを評価した値を返します。
...数 default が与えられていればその値を、ブロッ
クが与えられていればそのブロックを評価した値を返します。
fetchはハッシュ自身にデフォルト値が設定されていても単に無視します(挙動に変化がありません)。
@param key......ます。
@param default 該当するキーが登録されていない時の返り値を指定します。
@raise KeyError 引数defaultもブロックも与えられてない時、キーの探索に失敗すると発生します。
//emlist[例][ruby]{
h = {one: nil}
p h[:one],h[:two].......fetch(:one) #=> nil
p h.fetch(:two) # エラー key not found (KeyError)
p h.fetch(:two,"error") #=> "error"
p h.fetch(:two){|key|"#{key} not exist"} #=> "two not exist"
p h.fetch(:two, "error"){|key| #=> "two not exist"...