84件ヒット
[1-84件を表示]
(0.058秒)
別のキーワード
クラス
- Exception (24)
-
OpenSSL
:: BN (12) - StringScanner (48)
キーワード
- == (12)
-
backtrace
_ locations (12) -
check
_ until (12) -
prime
_ fasttest? (12) -
scan
_ full (12) -
search
_ full (12)
検索結果
先頭5件
-
StringScanner
# check(regexp) -> String | nil (18132.0) -
現在位置から regexp とのマッチを試みます。 マッチに成功したらマッチした部分文字列を返します。 マッチに失敗したら nil を返します。
...ポインタを進めません。
@param regexp マッチに用いる正規表現を指定します。
//emlist[例][ruby]{
require 'strscan'
s = StringScanner.new('test string')
s.check(/\w+/) # => "test"
s.pos # => 0
s.matched # => "test"
s.check(/\s+/) # => nil
s.matched # =... -
StringScanner
# check _ until(regexp) -> String | nil (6126.0) -
regexp が一致するまで文字列をスキャンします。 マッチに成功したらスキャン開始位置からマッチ部分の末尾までの部分文字列を返します。 マッチに失敗したら nil を返します。
...マッチが成功してもスキャンポインタを進めません。
@param regexp マッチに用いる正規表現を指定します。
//emlist[例][ruby]{
require 'strscan'
s = StringScanner.new('test string')
s.check_until(/str/) # => "test str"
s.matched # => "str"
s.pos... -
OpenSSL
:: BN # prime _ fasttest?(checks=nil , vtrivdiv=true) -> bool (137.0) -
自身が素数であるなら true を返します。
...します。
Miller-Rabin 法により確率的に判定します。
checksで指定した回数だけ繰り返します。
checksがnilである場合は OpenSSL が適切な
回数を判断します。
//emlist[][ruby]{
require 'openssl'
# 181 は 「小さな素数」である
OpenSSL::BN.new(......# => false
OpenSSL::BN.new("181").prime_fasttest?(nil, false) # => true
//}
@param checks Miller-Robin法の繰り返しの回数
@param vtrivdiv 真なら小さな素数で割ることでの素数判定を試みます
@raise OpenSSL::BNError 判定時にエラーが発生
@see OpenSSL::BN#prime?... -
StringScanner
# scan _ full(regexp , s , f) -> object (49.0) -
スキャンポインタの位置から regexp と文字列のマッチを試します。
...同等。
* scan_full(regexp, false, true) は StringScanner#check と同等。
* scan_full(regexp, false, false) は StringScanner#match? と同等。
@param regexp マッチに用いる正規表現を指定します。
@param s true ならばスキャンポインタを進めます。......lse ならばスキャンポインタを進めません。
@param f true ならばマッチした部分文字列を返します。
false ならばマッチした部分文字列の長さを返します。
//emlist[例][ruby]{
require 'strscan'
s = StringScanner.new('test string')
p s.scan......true, true) #=> "test"
p s.scan_full(/\s+/, false, true) #=> " "
p s.scan_full(/\s+/, true, false) #=> 1
p s.scan_full(/\w+/, false, false) #=> 6
p s.scan_full(/\w+/, true, true) #=> "string"
//}
@see StringScanner#scan StringScanner#skip StringScanner#check StringScanner#match?... -
StringScanner
# search _ full(regexp , s , f) -> object (49.0) -
regexp で指定された正規表現とマッチするまで文字列をスキャンします。
...。
* search_full(regexp, false, true) は StringScanner#check_until と同等。
* search_full(regexp, false, false) は StringScanner#exist? と同等。
@param regexp マッチに用いる正規表現を指定します。
@param s true ならばスキャンポインタを進めます。......lse ならばスキャンポインタを進めません。
@param f true ならばマッチした部分文字列を返します。
false ならばマッチした部分文字列の長さを返します。
//emlist[例][ruby]{
require 'strscan'
s = StringScanner.new('test string')
p s.s......earch_full(/t/, true, true) #=> "t"
p s.search_full(/str/, false, true) #=> "est str"
p s.search_full(/string/, true, true) #=> "est string"
//}
@see StringScanner#scan_until StringScanner#skip_until StringScanner#check_until StringScanner#exist?... -
Exception
# backtrace _ locations -> [Thread :: Backtrace :: Location] (37.0) -
バックトレース情報を返します。Exception#backtraceに似ていますが、 Thread::Backtrace::Location の配列を返す点が異なります。
...ん。
//emlist[例: test.rb][ruby]{
require "date"
def check_long_month(month)
return if Date.new(2000, month, -1).day == 31
raise "#{month} is not long month"
end
def get_exception
return begin
yield
rescue => e
e
end
end
e = get_exception { check_long_month(2) }
p e.backtrace......_locations
# => ["test.rb:4:in `check_long_month'", "test.rb:15:in `block in <main>'", "test.rb:9:in `get_exception'", "test.rb:15:in `<main>'"]
//}
@see Exception#backtrace... -
Exception
# ==(other) -> bool (31.0) -
自身と指定された other のクラスが同じであり、 message と backtrace が == メソッドで比較して 等しい場合に true を返します。そうでない場合に false を返します。
...す。
@param other 自身と比較したいオブジェクトを指定します。
自身と異なるクラスのオブジェクトを指定した場合は
Exception#exception を実行して変換を試みます。
//emlist[例][ruby]{
require "date"
def check_long_mont......h} is not long month"
end
def get_exception
return begin
yield
rescue => e
e
end
end
results = [2, 2, 4].map { |e | get_exception { check_long_month(e) } }
p results.map { |e| e.class }
# => [RuntimeError, RuntimeError, RuntimeError]
p results.map { |e| e.message }
# => ["2 is not lo...