るりまサーチ

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

別のキーワード

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

ライブラリ

クラス

キーワード

検索結果

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 (125.0)

自身が素数であるなら true を返します。

...します。

Miller-Rabin 法により確率的に判定します。
check
sで指定した回数だけ繰り返します。
check
sがnilである場合は OpenSSL が適切な
回数を判断します。

//emlist[][ruby]{
require
'openssl'

# 181 は 「小さな素数」である
OpenSSL::BN.new(...
..."181").prime_fasttest?(nil, true) # => false
OpenSSL::BN.new("181").prime_fasttest?(nil, false) # => true
//}

@param checks Miller-Robin法の繰り返しの回数
@param vtrivdiv 真なら小さな素数で割ることでの素数判定を試みます
@raise OpenSSL::BNError 判定時にエラー...

StringScanner#scan_full(regexp, s, f) -> object (43.0)

スキャンポインタの位置から regexp と文字列のマッチを試します。

...等。
* scan_full(regexp, false, true) は StringScanner#check と同等。
* scan_full(regexp, false, false) は StringScanner#match? と同等。

@param regexp マッチに用いる正規表現を指定します。

@param s true ならばスキャンポインタを進めます。...
...e ならばスキャンポインタを進めません。

@param f true ならばマッチした部分文字列を返します。
false ならばマッチした部分文字列の長さを返します。

//emlist[例][ruby]{
require
'strscan'

s = StringScanner.new('test string')
p s.scan_f...
...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 (43.0)

regexp で指定された正規表現とマッチするまで文字列をスキャンします。

...* search_full(regexp, false, true) は StringScanner#check_until と同等。
* search_full(regexp, false, false) は StringScanner#exist? と同等。

@param regexp マッチに用いる正規表現を指定します。

@param s true ならばスキャンポインタを進めます。...
...e ならばスキャンポインタを進めません。

@param f true ならばマッチした部分文字列を返します。
false ならばマッチした部分文字列の長さを返します。

//emlist[例][ruby]{
require
'strscan'

s = StringScanner.new('test string')
p s.sea...
...rch_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#==(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...