るりまサーチ

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

別のキーワード

  1. net/imap param
  2. win32ole win32ole_param
  3. bodytypetext param
  4. bodytypebasic param
  5. win32ole_param new

ライブラリ

クラス

キーワード

検索結果

StringScanner#check(regexp) -> String | nil (18126.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 (6120.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 (119.0)

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

...返します。

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

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

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

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

Object#===(other) -> bool (61.0)

case 式で使用されるメソッドです。d:spec/control#case も参照してください。

...て === を呼び出すことに注意してください。

また Enumerable#grep でも使用されます。

@param other 比較するオブジェクトです。

//emlist[][ruby]{
age = 12
# (0..2).===(12), (3..6).===(12), ... が実行される
result =
case age
when 0 .. 2
"baby"
wh...
...def check arg
case arg
when /ruby(?!\s*on\s*rails)/i
"hit! #{arg}"
when String
"Instance of String class. But don't hit."
else
"unknown"
end
end

puts check([]) #=> unknown
puts check("mash-up in Ruby on Rails") #=> instance of String class. But not hit...
puts check("<Ruby's...
...world>") #=> hit! <Ruby's world>
//}

@see Object#==, Range#===, Module#===, Regexp#===, Enumerable#grep...

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

WIN32OLE#ole_query_interface(iid) -> WIN32OLE (25.0)

IID(インターフェイスID)を指定してオブジェクトの別のインターフェイスを 持つオブジェクトを取得します。

...持つ場合に、当
メソッドを利用して既定のインターフェイスとは異なるインターフェイスを取
得します。

@param iid 取得するインターフェイスのIIDを文字列で指定します。
@return iidパラメータで指定したインターフェイスを...
...として定義しなけれ
ば追加のメソッドが呼び出せません。

たとえば、当メソッドの存在理由である
http://www.ruby-forum.com/topic/109954(なお、元のパッチと異な
りGUIDの統一フォーマットを利用するように改造されているため、I...
...で追加されたメソッド
(たとえばGetProjectTemplate)を指定したとしても正しく呼び出せます。つ
まり、http://www.ruby-forum.com/topic/109954で例示されているよ
うなole_query_interfaceメソッドの呼び出しは不要です。

もし、当メソッド...