238件ヒット
[1-100件を表示]
(0.223秒)
別のキーワード
ライブラリ
クラス
- Dir (8)
- Matrix (23)
-
REXML
:: Entity (11) - StringScanner (22)
-
Thread
:: Queue (11) -
Thread
:: SizedQueue (33) - ThreadsWait (12)
オブジェクト
-
Readline
:: HISTORY (33)
キーワード
- ConditionVariable (11)
- NKF (11)
- Ruby用語集 (11)
- antisymmetric? (6)
-
cgi
/ session (11) - deq (11)
- empty? (36)
- eos? (11)
- length (11)
- matches? (11)
-
net
/ pop (11) -
next
_ wait (6) - optparse (11)
- pop (11)
-
ruby 1
. 8 . 4 feature (11) - shift (22)
- size (11)
-
skew
_ symmetric? (6) - 制御構造 (8)
検索結果
先頭5件
-
Matrix
. empty(row _ size=0 , column _ size=0) -> Matrix (27419.0) -
要素を持たない行列を返します。
...ize 、 column_size のいずれか一方は0である必要があります。
//emlist[例][ruby]{
require 'matrix'
m = Matrix.empty(2, 0)
m == Matrix[ [], [] ]
# => true
n = Matrix.empty(0, 3)
n == Matrix.columns([ [], [], [] ])
# => true
m * n
# => Matrix[[0, 0, 0], [0, 0, 0]]
//}
@param row_si......ze 行列の行数
@param column_size 行列の列数
@raise ArgumentError row_size, column_size が両方とも0でない場合に発生します... -
Dir
. empty?(path _ name) -> bool (15225.0) -
path_name で与えられたディレクトリが空の場合に真を返します。 ディレクトリでない場合や空でない場合に偽を返します。
..._name で与えられたディレクトリが空の場合に真を返します。
ディレクトリでない場合や空でない場合に偽を返します。
//emlist[例][ruby]{
Dir.empty?('.') #=> false
Dir.empty?(IO::NULL) #=> false
require 'tmpdir'
Dir.mktmpdir { |dir| Dir.empty?(dir) }......#=> true
//}
@param path_name 確認したいディレクトリ名。... -
ThreadsWait
# empty? -> bool (15225.0) -
同期されるスレッドが存在するならば true をかえします。
...ッドが存在するならば true をかえします。
使用例
require 'thwait'
threads = []
3.times {|i|
threads << Thread.new { sleep 1; p Thread.current }
}
thall = ThreadsWait.new
p thall.threads.empty? #=> true
thall.join(*threads)
p thall.threads.empty? #=> false... -
ThreadsWait
# next _ wait(nonblock = nil) -> Thread (15224.0) -
指定したスレッドのどれかが終了するまで待ちます。
...す。
@param nonblock true を与えると、キューが空の時、例外 ThreadsWait::ErrNoFinishedThread が発生します。
@raise ErrNoWaitingThread 終了をまつスレッドが存在しない時、発生します。
@raise ErrNoFinishedThread nonblock がtrue でかつ、キューが......空の時、発生します。
#使用例
require 'thwait'
threads = []
2.times {|i|
threads << Thread.new { sleep i }
}
thall = ThreadsWait.new
thall.join_nowait(*threads)
until thall.empty?
th = thall.next_wait
p th
end
@see Queue#pop... -
Readline
:: HISTORY . empty? -> bool (15219.0) -
ヒストリに格納された内容の数が 0 の場合は true を、 そうでない場合は false を返します。
...リに格納された内容の数が 0 の場合は true を、
そうでない場合は false を返します。
例:
require "readline"
p Readline::HISTORY.empty? #=> true
Readline::HISTORY.push("foo", "bar", "baz")
p Readline::HISTORY.empty? #=> false
@see Readline::HISTORY.length... -
StringScanner
# empty? -> bool (15213.0) -
スキャンポインタが文字列の末尾を指しているなら true を、 末尾以外を指しているなら false を返します。
...いるなら true を、
末尾以外を指しているなら false を返します。
//emlist[例][ruby]{
require 'strscan'
s = StringScanner.new('test string')
s.eos? # => false
s.scan(/\w+/)
s.scan(/\s+/)
s.scan(/\w+/)
s.eos? # => true
//}
StringScanner#empty? は将来のバー......ジョンで削除される予定です。
代わりに StringScanner#eos? を使ってください。... -
Matrix
# antisymmetric? -> bool (12212.0) -
行列が反対称行列 (交代行列、歪〔わい〕対称行列とも) ならば true を返します。
...ue を返します。
@raise ExceptionForMatrix::ErrDimensionMismatch 行列が正方行列でない場合に発生します
//emlist[][ruby]{
require 'matrix'
Matrix[[0, -2, Complex(1, 3)], [2, 0, 5], [-Complex(1, 3), -5, 0]].antisymmetric? # => true
Matrix.empty.antisymmetric? # => true
Matrix......[[1, 2, 3], [4, 5, 6], [7, 8, 9]].antisymmetric? # => false
# 対角要素が違う
Matrix[[1, -2, 3], [2, 0, 6], [-3, -6, 0]].antisymmetric? # => false
# 符号が違う
Matrix[[0, 2, -3], [2, 0, 6], [-3, 6, 0]].antisymmetric? # => false
//}... -
Matrix
# skew _ symmetric? -> bool (12212.0) -
行列が反対称行列 (交代行列、歪〔わい〕対称行列とも) ならば true を返します。
...ue を返します。
@raise ExceptionForMatrix::ErrDimensionMismatch 行列が正方行列でない場合に発生します
//emlist[][ruby]{
require 'matrix'
Matrix[[0, -2, Complex(1, 3)], [2, 0, 5], [-Complex(1, 3), -5, 0]].antisymmetric? # => true
Matrix.empty.antisymmetric? # => true
Matrix......[[1, 2, 3], [4, 5, 6], [7, 8, 9]].antisymmetric? # => false
# 対角要素が違う
Matrix[[1, -2, 3], [2, 0, 6], [-3, -6, 0]].antisymmetric? # => false
# 符号が違う
Matrix[[0, 2, -3], [2, 0, 6], [-3, 6, 0]].antisymmetric? # => false
//}... -
Readline
:: HISTORY . size -> Integer (12212.0) -
ヒストリに格納された内容の数を取得します。
...ヒストリに格納された内容の数を取得します。
例: ヒストリの内容を最初から順番に出力する。
require "readline"
Readline::HISTORY.push("foo", "bar", "baz")
p Readline::HISTORY.length #=> 3
@see Readline::HISTORY.empty?... -
StringScanner
# eos? -> bool (12113.0) -
スキャンポインタが文字列の末尾を指しているなら true を、 末尾以外を指しているなら false を返します。
...いるなら true を、
末尾以外を指しているなら false を返します。
//emlist[例][ruby]{
require 'strscan'
s = StringScanner.new('test string')
s.eos? # => false
s.scan(/\w+/)
s.scan(/\s+/)
s.scan(/\w+/)
s.eos? # => true
//}
StringScanner#empty? は将来のバー......ジョンで削除される予定です。
代わりに StringScanner#eos? を使ってください。... -
cgi
/ session (12048.0) -
CGI のセッション管理を行うライブラリ。
...CGI のセッション管理を行うライブラリ。
セッションとは、HTTP の一連のリクエストとレスポンスが属するべき
コンテクスト (状況) のことをいいます。
セッション管理には従来通り cgi ライブラリが提供する
クッキーを使......i/session を使用した方がよりわかりやすいでしょう。
セッション情報は Hash ライクなインターフェースです。
セッションはセッション ID とプログラムが記録した
セッション情報から構成されます。
デフォルトでは CGI::Sessi...... ID を
クッキーあるいは form の hidden input として渡すことになります。
クッキーはデフォルトでは expires が指定されていないために、
ブラウザを終了した時点で消滅します。
=== 使い方 (生成)
require 'cgi/session'
cgi = CGI.new... -
Thread
:: ConditionVariable (12024.0) -
スレッドの同期機構の一つである状態変数を実現するクラスです。
...つである状態変数を実現するクラスです。
以下も ConditionVariable を理解するのに参考になります。
https://ruby-doc.com/docs/ProgrammingRuby/html/tut_threads.html#UF
=== Condition Variable とは
あるスレッド A が排他領域で動いていたとします......tex.synchronize {
# 上の条件を満たすための操作
cv.signal
}
}
以下は 14445 で紹介されている例です。@q が空になった場合、
あるいは満タンになった場合に Condition Variable を使って wait しています。
require......thread'
class TinyQueue
def initialize(max=2)
@max = max
@full = ConditionVariable.new
@empty = ConditionVariable.new
@mutex = Mutex.new
@q = []
end
def count
@q.size
end
def enq(v)
@mutex.synchronize{
@full.wait(@mutex) if c...