るりまサーチ

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

別のキーワード

  1. kernel require
  2. getoptlong require_order
  3. rubygems/custom_require require
  4. irb/ext/use-loader irb_require
  5. require execute

ライブラリ

キーワード

検索結果

<< 1 2 3 ... > >>

Array#sample -> object | nil (18135.0)

配列の要素を1個(引数を指定した場合は自身の要素数を越えない範囲で n 個) ランダムに選んで返します。

..._a
p a.sample #=> 9
p a.sample #=> 10
p a.sample(3) #=> [1, 9, 3]
p a #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
//}

random SecureRandom などの乱数生成器を渡すことができます。

//emlist[例][ruby]{
require
'securerandom'
a = (1..10).to_a
p a.sample(rando...

Array#sample(n) -> Array (18135.0)

配列の要素を1個(引数を指定した場合は自身の要素数を越えない範囲で n 個) ランダムに選んで返します。

..._a
p a.sample #=> 9
p a.sample #=> 10
p a.sample(3) #=> [1, 9, 3]
p a #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
//}

random SecureRandom などの乱数生成器を渡すことができます。

//emlist[例][ruby]{
require
'securerandom'
a = (1..10).to_a
p a.sample(rando...

Array#sample(n, random: Random) -> Array (18135.0)

配列の要素を1個(引数を指定した場合は自身の要素数を越えない範囲で n 個) ランダムに選んで返します。

..._a
p a.sample #=> 9
p a.sample #=> 10
p a.sample(3) #=> [1, 9, 3]
p a #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
//}

random SecureRandom などの乱数生成器を渡すことができます。

//emlist[例][ruby]{
require
'securerandom'
a = (1..10).to_a
p a.sample(rando...

Array#sample(random: Random) -> object | nil (18135.0)

配列の要素を1個(引数を指定した場合は自身の要素数を越えない範囲で n 個) ランダムに選んで返します。

..._a
p a.sample #=> 9
p a.sample #=> 10
p a.sample(3) #=> [1, 9, 3]
p a #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
//}

random SecureRandom などの乱数生成器を渡すことができます。

//emlist[例][ruby]{
require
'securerandom'
a = (1..10).to_a
p a.sample(rando...

Rake::MakefileLoader#load(filename) (31.0)

与えられた Makefile をロードします。

...記載例とする
require
"rake/loaders/makefile"

task default: :test_rake_app

open "sample.mf", "w" do |io|
io << <<-'SAMPLE_MF'
# Comments
a: a1 a2 a3 a4
b: b1 b2 b3 \
b4 b5 b6\
# Mid: Comment
b7
a : a5 a6 a7
c: c1
d: d1 d2 \
e f : e1 f1
g\ 0: g1 g\ 2 g\ 3 g4
SAMPLE
_MF
end

task :test_r...
...ake_app do |task|
loader = Rake::MakefileLoader.new
loader.load("sample.mf")
p Rake::Task.task_defined?("a") # => true
p Rake::Task.tasks[0] # => <Rake::FileTask a => [a1, a2, a3, a4, a5, a6, a7]>
end
//}...

絞り込み条件を変える

Rake::Application#add_loader(ext, loader) (25.0)

与えられた拡張子で終わるファイル名のファイルをロードするためのローダーを 自身に追加します。

...y]{
require
"rake/loaders/makefile"

# Rakefile での記載例とする

task default: :test
task :test

makefile =<<-EOS
<< <<-'SAMPLE_MF'
# Comments
a: a1 a2 a3 a4
EOS
IO.write("sample.mf", makefile)
Rake.application.add_loader("mf", Rake::MakefileLoader.new)
Rake.application.add_import("sample.m...

Pathname#split -> Array (19.0)

File.split(self.to_s) と同じです。

...File.split(self.to_s) と同じです。

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

pathname = Pathname("/path/to/sample")
pathname.split # => [#<Pathname:/path/to>, #<Pathname:sample>]
//}

@see File.split...

Rake::PackageTask#name -> String (19.0)

バージョン情報を含まないパッケージの名前を返します。

...バージョン情報を含まないパッケージの名前を返します。

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

Rake::PackageTask.new("sample", "1.0.0") do |package_task|
package_task.name # => "sample"
end
//}...

Rake::PackageTask#name=(name) (19.0)

バージョン情報を含まないパッケージの名前をセットします。

...ame パッケージの名前を指定します。

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

Rake::PackageTask.new("sample", "1.0.0") do |package_task|
package_task.name # => "sample"
package_task.name = "update"
package_task.name # => "update"
end
//}...
<< 1 2 3 ... > >>