るりまサーチ

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

別のキーワード

  1. net/imap param
  2. win32ole win32ole_param
  3. win32ole_param name
  4. win32ole_param default
  5. win32ole_param input?

検索結果

<< 1 2 3 ... > >>

Array#sample -> object | nil (18140.0)

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

...

配列が空の場合、無引数の場合は nil を、個数を指定した場合は空配列を返します。

srand()が有効です。

@param n 取得する要素の数を指定します。自身の要素数(self.length)以上の
値を指定した場合は要素数と同じ数...
...
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。

@param random 乱数生成器(主に Random オブジェクト)を指定します。
選択する要素のインデックスを返す rand...
..._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 (18140.0)

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

...

配列が空の場合、無引数の場合は nil を、個数を指定した場合は空配列を返します。

srand()が有効です。

@param n 取得する要素の数を指定します。自身の要素数(self.length)以上の
値を指定した場合は要素数と同じ数...
...
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。

@param random 乱数生成器(主に Random オブジェクト)を指定します。
選択する要素のインデックスを返す rand...
..._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 (18140.0)

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

...

配列が空の場合、無引数の場合は nil を、個数を指定した場合は空配列を返します。

srand()が有効です。

@param n 取得する要素の数を指定します。自身の要素数(self.length)以上の
値を指定した場合は要素数と同じ数...
...
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。

@param random 乱数生成器(主に Random オブジェクト)を指定します。
選択する要素のインデックスを返す rand...
..._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 (18140.0)

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

...

配列が空の場合、無引数の場合は nil を、個数を指定した場合は空配列を返します。

srand()が有効です。

@param n 取得する要素の数を指定します。自身の要素数(self.length)以上の
値を指定した場合は要素数と同じ数...
...
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。

@param random 乱数生成器(主に Random オブジェクト)を指定します。
選択する要素のインデックスを返す rand...
..._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...

Object#respond_to_missing?(symbol, include_private) -> bool (72.0)

自身が symbol で表されるメソッドに対し BasicObject#method_missing で反応するつもりならば真を返します。

...す。

@param symbol メソッド名シンボル
@param include_private private method も含めたい場合に true が渡されます

//emlist[例][ruby]{
class Sample
def method_missing(name, *args)
if name =~ /^to_*/
[name, *args] # => [:to_sample, "sample args1", "sample args2"]...
...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::FileList#egrep(pattern) {|filename, count, line| ... } (66.0)

与えられたパターンをファイルリストから grep のように検索します。

...

@param pattern 正規表現を指定します。

//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*')...
...=> "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"
//}...

ObjectSpace.#undefine_finalizer(obj) -> object (42.0)

obj に対するファイナライザをすべて解除します。 obj を返します。

...j を返します。

@param obj ファイナライザを解除したいオブジェクトを指定します。

//emlist[例][ruby]{
class Sample
def Sample.callback
proc {
puts "finalize"
}
end

def initialize
ObjectSpace.define_finalizer(self, Sample.callback)
end

def...
...undef
ObjectSpace.undefine_finalizer(self)
end
end

Sample
.new
GC.start
# => finalize

Sample
.new
sample
.undef
GC.start
# ※何も出力されない
//}

@see ObjectSpace.#define_finalizer...

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

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

...@param ext 拡張子を指定します。

@param 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.m...
...f", 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::MakefileLoader#load(filename) (30.0)

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

...efile をロードします。

@param filename 読み込む 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:...
...\
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 = Rake::MakefileLoader.new
loader.load("sample.mf")
p Rake::Task.task_defined?("a") # => true
p Rake::Task.tasks[0] # => <Rake::FileTask a...
<< 1 2 3 ... > >>