274件ヒット
[1-100件を表示]
(0.064秒)
ライブラリ
- ビルトイン (94)
- pathname (24)
- rake (12)
-
rake
/ loaders / makefile (12) -
rake
/ packagetask (132)
クラス
- Array (24)
- NameError (10)
- Object (12)
- Pathname (24)
- Proc (12)
-
Rake
:: Application (12) -
Rake
:: MakefileLoader (12) -
Rake
:: PackageTask (132) - Random (36)
キーワード
-
add
_ loader (12) - binding (12)
- delete (12)
- load (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) - rand (36)
- receiver (10)
-
respond
_ to _ missing? (12) - unlink (12)
検索結果
先頭5件
-
Array
# sample(n , random: Random) -> Array (18329.0) -
配列の要素を1個(引数を指定した場合は自身の要素数を越えない範囲で n 個) ランダムに選んで返します。
...な配列になります。
配列が空の場合、無引数の場合は nil を、個数を指定した場合は空配列を返します。
srand()が有効です。
@param n 取得する要素の数を指定します。自身の要素数(self.length)以上の
値を指定した場合......dom 乱数生成器(主に Random オブジェクト)を指定します。
選択する要素のインデックスを返す rand メソッドに応答する
オブジェクトであれば指定する事ができます。rand メソッド
の引数には Rand......om#rand(max) のように選択可能なイン
デックスの最大値が指定されます。
Kernel.#rand、Random を使用しないオブジェク
トを指定した場合、Kernel.#srandの指定に影響されません。
@raise TypeError 引数 n... -
Array
# sample(random: Random) -> object | nil (18329.0) -
配列の要素を1個(引数を指定した場合は自身の要素数を越えない範囲で n 個) ランダムに選んで返します。
...な配列になります。
配列が空の場合、無引数の場合は nil を、個数を指定した場合は空配列を返します。
srand()が有効です。
@param n 取得する要素の数を指定します。自身の要素数(self.length)以上の
値を指定した場合......dom 乱数生成器(主に Random オブジェクト)を指定します。
選択する要素のインデックスを返す rand メソッドに応答する
オブジェクトであれば指定する事ができます。rand メソッド
の引数には Rand......om#rand(max) のように選択可能なイン
デックスの最大値が指定されます。
Kernel.#rand、Random を使用しないオブジェク
トを指定した場合、Kernel.#srandの指定に影響されません。
@raise TypeError 引数 n... -
Proc
# binding -> Binding (6213.0) -
Proc オブジェクトが保持するコンテキストを Binding オブジェクトで返します。
...Proc オブジェクトが保持するコンテキストを
Binding オブジェクトで返します。
//emlist[例][ruby]{
def fred(param)
proc {}
end
sample_proc = fred(99)
eval("param", sample_proc.binding) # => 99
//}... -
Rake
:: PackageTask # package _ dir=(dirname) (6207.0) -
パッケージに入れるファイルを保存するディレクトリ名をセットします。
...す。
@param dirname パッケージに入れるファイルを保存するディレクトリ名を指定します。
//emlist[][ruby]{
# Rakefile での記載例とする
require 'rake/packagetask'
Rake::PackageTask.new("sample", "1.0.0") do |package_task|
package_task.package_dir # => "pkg"......package_task.package_dir = "package"
package_task.package_dir # => "package"
end
//}... -
Object
# respond _ to _ missing?(symbol , include _ private) -> bool (6161.0) -
自身が symbol で表されるメソッドに対し BasicObject#method_missing で反応するつもりならば真を返します。
...ethod_missing で反応するつもりならば真を返します。
Object#respond_to? はメソッドが定義されていない場合、
デフォルトでこのメソッドを呼びだし問合せます。
BasicObject#method_missing を override した場合にこのメソッドも
override......ude_private 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_missing?(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
:: MakefileLoader # load(filename) (6143.0) -
与えられた Makefile をロードします。
...ke/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_rake_app do |task|
loader = R......ake::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) (6119.0) -
与えられた拡張子で終わるファイル名のファイルをロードするためのローダーを 自身に追加します。
...aram loader ローダーを指定します。
//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::MakefileLoader.new)
Rake.application.add_import("sample.mf")
Rake::Task.task_defined?("a") # => false
Rake.application.load_imports
Rake::Task.task_defined?("a") # => true
//}... -
Rake
:: PackageTask # package _ dir _ path -> String (6113.0) -
パッケージに含むファイルを配置するディレクトリを返します。
...パッケージに含むファイルを配置するディレクトリを返します。
//emlist[][ruby]{
# Rakefile での記載例とする
require 'rake/packagetask'
Rake::PackageTask.new("sample", "1.0.0") do |package_task|
package_task.package_dir_path # => "pkg/sample-1.0.0"
end
//}... -
Random
# rand -> Float (6113.0) -
一様な擬似乱数を発生させます。
...は乱数の範囲から除かれます。
range.end - range.begin が整数を返す場合は range.begin + self.rand((range.end - range.begin) + e)
の値を返します(e は終端を含む場合は1、含まない場合は0です)。
range.end - range.begin が実数を返す場合も同様で......Range オブジェクトで指定します。
range.end - range.begin は数値である必要があり、
range.begin + 数値 が適切な値を返す必要があります。
@raise Errno::EDOM rand(1..Float::INFINITY) などのように範囲に問題があるときに......by]{
# Kernel.#rand とほぼ同様の使い勝手
prng = Random.new(1234)
prng.rand # => 0.1915194503788923
srand(1234)
rand # => 0.1915194503788923
# max に実数も指定出来る
prng.rand(6.5) # => 4.043707011758907
# (rand(6) と同等)
rand(6.5) #...