るりまサーチ

最速Rubyリファレンスマニュアル検索!
466件ヒット [201-300件を表示] (0.125秒)

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

モジュール

キーワード

検索結果

<< < 1 2 3 4 5 > >>

Array#fill(val) -> self (6118.0)

すべての要素に val をセットします。

...とします。

@param val 自身にセットしたいオブジェクトを指定します。

//emlist[例][ruby]{
a = [0, 1, 2, 3, 4]
a.fill(10)
p a #=> [10, 10, 10, 10, 10]

a = [0, 1, 2, 3, 4]
a.fill("a")
p a #=> ["a", "a", "a", "a", "a"]
a[0].capitalize!
p a #=> ["A", "A", "A", "A", "A"]
//}...

Array#slice!(range) -> Array | nil (6115.0)

指定した部分配列を自身から取り除き、取り除いた部分配列を返します。取り除く要素がなければ nil を返します。

...定した部分配列を自身から取り除き、取り除いた部分配列を返します。取り除く要素がなければ nil
を返します。

@param start 削除したい部分配列の先頭のインデックスを整数で指定します。

@param len 削除したい部分配列の長...
...

@param range 削除したい配列の範囲を Range オブジェクトで指定します。

//emlist[例][ruby]{
a = [ "a", "b", "c" ]
a.slice!(1, 2) #=> ["b", "c"]
a #=> ["a"]

a = [ "a", "b", "c" ]
a.slice!(1, 0) #=> []
a #=> [ "a", "b", "c" ]
//}...

String#end_with?(*strs) -> bool (6113.0)

self の末尾が strs のいずれかであるとき true を返します。

...ずれかであるとき true を返します。

@param strs パターンを表す文字列 (のリスト)

//emlist[例][ruby]{
"string".end_with?("ing") # => true
"string".end_with?("str") # => false
"string".end_with?("str", "ing") # => true
//}

@see String#start_with?...
...@param strs パターンを表す文字列 (のリスト)

//emlist[例][ruby]{
"string".end_with?("ing") # => true
"string".end_with?("str") # => false
"string".end_with?("str", "ing") # => true
//}

@see String#start_with?
@see String#delete_suffix, String#delete_suffix!...

Symbol#end_with?(*suffixes) -> bool (6113.0)

self の末尾が suffixes のいずれかであるとき true を返します。

...ffixes のいずれかであるとき true を返します。

(self.to_s.end_with?と同じです。)

@param suffixes パターンを表す文字列 (のリスト)

@see Symbol#start_with?

@see String#end_with?

//emlist[][ruby]{
:hello.end_with?("ello") #=> true

# returns true if...
...one of the +suffixes+ matches.
:hello.end_with?("heaven", "ello") #=> true
:hello.end_with?("heaven", "paradise") #=> false
//}...

Array#slice!(nth) -> object | nil (6110.0)

指定した要素を自身から取り除き、取り除いた要素を返します。取り除く要素がなければ nil を返します。

...ければ nil
を返します。

@param nth 取り除く要素のインデックスを整数で指定します。

//emlist[例][ruby]{
a = [ "a", "b", "c" ]
a.slice!(1) #=> "b"
a #=> ["a", "c"]
a.slice!(-1) #=> "c"
a #=> ["a"]
a.slice!(100) #=> nil
a...

絞り込み条件を変える

Thread::Queue#shift(non_block = false) -> object (3125.0)

キューからひとつ値を取り出します。キューが空の時、呼出元のスレッドは停止します。

...mlist[例][ruby]{
require 'thread'

q = Queue.new

th1 = Thread.start do
while resource = q.pop
puts resource
end
end

[:resource1, :resource2, :resource3, nil].each { |r|
q.push(r)
}

th1.join
//}

//emlist[例: nonblock = true][ruby]{
require 'thread'

q = Queue.new

th1 = Thread.start d...
...o
while resource = q.pop
puts resource
end
end

[:resource1, :resource2, :resource3, nil].each { |r|
q.push(r)
}

begin
th1.join
q.pop(true)
rescue => e
p e
end

# => resource1
# resource2
# resource3
# => #<ThreadError: queue empty>
# => "queue empty"
//}...

Thread::SizedQueue#deq(non_block = false) -> object (3025.0)

キューからひとつ値を取り出します。 キューに push しようと待っているスレッドがあれば、実行を再開させます。

...emlist[例][ruby]{
require 'thread'

q = SizedQueue.new(4)

th1 = Thread.start do
while resource = q.pop
puts resource
end
end

[:resource1, :resource2, :resource3, nil].each{|r|
q.push(r)
}

th1.join
# => resource1
# resource2
# resource3
//}

//emlist[例: nonblock = true][ruby]{
require...
...'thread'

q = SizedQueue.new(4)

th1 = Thread.start do
while resource = q.pop
puts resource
end
end

[:resource1, :resource2, :resource3, nil].each{|r|
q.push(r)
}

begin
th1.join
q.pop(true)
rescue => e
p e
p e.message
end

# => resource1
# resource2
# resource3
# => #<ThreadErro...

Thread::SizedQueue#pop(non_block = false) -> object (3025.0)

キューからひとつ値を取り出します。 キューに push しようと待っているスレッドがあれば、実行を再開させます。

...emlist[例][ruby]{
require 'thread'

q = SizedQueue.new(4)

th1 = Thread.start do
while resource = q.pop
puts resource
end
end

[:resource1, :resource2, :resource3, nil].each{|r|
q.push(r)
}

th1.join
# => resource1
# resource2
# resource3
//}

//emlist[例: nonblock = true][ruby]{
require...
...'thread'

q = SizedQueue.new(4)

th1 = Thread.start do
while resource = q.pop
puts resource
end
end

[:resource1, :resource2, :resource3, nil].each{|r|
q.push(r)
}

begin
th1.join
q.pop(true)
rescue => e
p e
p e.message
end

# => resource1
# resource2
# resource3
# => #<ThreadErro...

Thread::ConditionVariable#broadcast -> self (3019.0)

状態変数を待っているスレッドをすべて再開します。再開された スレッドは Thread::ConditionVariable#wait で指定した mutex のロックを試みます。

...:ConditionVariable#wait
で指定した mutex のロックを試みます。

@return 常に self を返します。

//emlist[例][ruby]{
mutex = Mutex.new
cv = ConditionVariable.new
flg = true

3.times {
Thread.start {
mutex.synchronize {
puts "a1"
while (flg)
cv.wait(mut...
...ex)
end
puts "a2"
}
}
}

Thread.start {
mutex.synchronize {
flg = false
cv.broadcast
}
}

sleep 1

# => a1
# => a1
# => a1
# => a2
# => a2
# => a2
//}...

Array#[](start, length) -> Array | nil (283.0)

start 番目から length 個の要素を含む部分配列を返します。 start が自身の範囲外となる時は nil を返します。ただし、start が配列の長さに等しいときは空の配列を返します。 length が負の時は nil を返します。

...
start
番目から length 個の要素を含む部分配列を返します。
start
が自身の範囲外となる時は nil を返します。ただし、start が配列の長さに等しいときは空の配列を返します。
length が負の時は nil を返します。

@param start 生成...
...スを整数で指定します。
start
の値が負の時には末尾からのインデックスと見倣します。
末尾の要素が -1 番目になります。
整数以外のオブジェクトを指定した場合は to_int メソッドによ...
...length が start 番目からの配列の長さより長い時には、越え
た分の長さは無視されます。
整数以外のオブジェクトを指定した場合は to_int メソッドに
よる暗黙の型変換を試みます。

@raise TypeErr...

絞り込み条件を変える

<< < 1 2 3 4 5 > >>