396件ヒット
[1-100件を表示]
(0.046秒)
別のキーワード
ライブラリ
- ビルトイン (108)
- pathname (36)
- rake (60)
-
rake
/ loaders / makefile (12) -
rake
/ packagetask (180)
クラス
- Array (48)
- Object (12)
- Pathname (36)
- Proc (12)
-
Rake
:: Application (12) -
Rake
:: FileList (12) -
Rake
:: MakefileLoader (12) -
Rake
:: PackageTask (180) - Random (36)
モジュール
-
Rake
:: TaskManager (36)
キーワード
-
add
_ loader (12) - binding (12)
- delete (12)
- egrep (12)
-
in
_ namespace (12) - intern (12)
- load (12)
- name (12)
- name= (12)
-
need
_ tar (12) -
need
_ tar= (12) -
need
_ tar _ bz2 (12) -
need
_ tar _ bz2= (12) -
need
_ tar _ gz (12) -
need
_ tar _ gz= (12) -
need
_ zip (12) -
need
_ zip= (12) -
package
_ dir (12) -
package
_ dir= (12) -
package
_ dir _ path (12) -
package
_ files (12) -
package
_ files= (12) - rand (36)
-
respond
_ to _ missing? (12) - split (12)
-
synthesize
_ file _ task (12) - unlink (12)
検索結果
先頭5件
-
Array
# sample -> object | nil (18153.0) -
配列の要素を1個(引数を指定した場合は自身の要素数を越えない範囲で n 個) ランダムに選んで返します。
...。
//emlist[例][ruby]{
a = (1..10).to_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 'securer......andom'
a = (1..10).to_a
p a.sample(random: SecureRandom) #=> 2
//}... -
Array
# sample(n) -> Array (18153.0) -
配列の要素を1個(引数を指定した場合は自身の要素数を越えない範囲で n 個) ランダムに選んで返します。
...。
//emlist[例][ruby]{
a = (1..10).to_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 'securer......andom'
a = (1..10).to_a
p a.sample(random: SecureRandom) #=> 2
//}... -
Array
# sample(n , random: Random) -> Array (18153.0) -
配列の要素を1個(引数を指定した場合は自身の要素数を越えない範囲で n 個) ランダムに選んで返します。
...。
//emlist[例][ruby]{
a = (1..10).to_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 'securer......andom'
a = (1..10).to_a
p a.sample(random: SecureRandom) #=> 2
//}... -
Array
# sample(random: Random) -> object | nil (18153.0) -
配列の要素を1個(引数を指定した場合は自身の要素数を越えない範囲で n 個) ランダムに選んで返します。
...。
//emlist[例][ruby]{
a = (1..10).to_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 'securer......andom'
a = (1..10).to_a
p a.sample(random: SecureRandom) #=> 2
//}... -
Object
# respond _ to _ missing?(symbol , include _ private) -> bool (73.0) -
自身が symbol で表されるメソッドに対し BasicObject#method_missing で反応するつもりならば真を返します。
...e private method も含めたい場合に true が渡されます
//emlist[例][ruby]{
class Sample
def method_missing(name, *args)
if name =~ /^to_*/
[name, *args] # => [:to_sample, "sample args1", "sample args2"]
return
else
super
end
end
def respond_to_missin......g?(sym, include_private)
(sym =~ /^to_*/) ? true : super
end
end
s = Sample.new
s.to_sample("sample args1", "sample args2")
s.respond_to?(:to_sample) # => true
s.respond_to?(:sample) # => false
//}
@see Object#respond_to?, BasicObject#method_missing... -
Rake
:: FileList # egrep(pattern) {|filename , count , line| . . . } (73.0) -
与えられたパターンをファイルリストから grep のように検索します。
...を指定します。
//emlist[][ruby]{
# Rakefile での記載例とする
IO.write("sample1", "line1\nline2\nline3\n")
IO.write("sample2", "line1\nline2\nline3\nline4\n")
task default: :test_rake_app
task :test_rake_app do
file_list = FileList.new('sample*')
file_list.egrep(/line/) # => 7......=> "filename = sample1, count = 1, line = line1\n"
# => "filename = sample1, count = 2, line = line2\n"
# => "filename = sample1, count = 3, line = line3\n"
# => "filename = sample2, count = 1, line = line1\n"
# => "filename = sample2, count = 2, line = line2\n"
# => "filename = sample2, count = 3,......line = line3\n"
# => "filename = sample2, count = 4, line = line4\n"
//}... -
Rake
:: MakefileLoader # load(filename) (37.0) -
与えられた Makefile をロードします。
...ilename 読み込む Makefile の名前を指定します。
//emlist[][ruby]{
# Rakefile での記載例とする
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......a6 a7
c: c1
d: d1 d2 \
e f : e1 f1
g\ 0: g1 g\ 2 g\ 3 g4
SAMPLE_MF
end
task :test_rake_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
:: TaskManager # synthesize _ file _ task(task _ name) -> Rake :: FileTask | nil (37.0) -
与えられたタスク名をもとにファイルタスクを合成します。
.../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_file => [... -
Rake
:: Application # add _ loader(ext , loader) (31.0) -
与えられた拡張子で終わるファイル名のファイルをロードするためのローダーを 自身に追加します。
...oader ローダーを指定します。
//emlist[例][ruby]{
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:...