別のキーワード
クラス
- Array (156)
- MatchData (78)
-
Net
:: HTTP (12) -
Net
:: HTTPResponse (12) - Object (12)
-
Psych
:: Stream (24) -
Psych
:: Visitors :: YAMLTree (12) - String (40)
- Symbol (12)
- Thread (24)
-
Thread
:: ConditionVariable (24) -
Thread
:: Queue (12) -
Thread
:: SizedQueue (36)
モジュール
- GC (12)
キーワード
- [] (84)
- at (12)
-
backtrace
_ locations (24) - broadcast (12)
- byteoffset (6)
-
delete
_ prefix (8) -
delete
_ prefix! (8) - deq (12)
-
end
_ with? (18) - fill (72)
-
garbage
_ collect (12) - head (12)
- offset (24)
- pop (12)
-
read
_ body (12) -
respond
_ to? (12) - shift (24)
- signal (12)
- slice! (36)
-
start
_ with? (18)
検索結果
先頭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...