るりまサーチ

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

別のキーワード

  1. kernel require
  2. getoptlong require_order
  3. rubygems/custom_require require
  4. irb/ext/use-loader irb_require
  5. require execute

ライブラリ

クラス

モジュール

検索結果

<< 1 2 > >>

StringScanner#check(regexp) -> String | nil (18120.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 # => nil
//}...

JSON::State#check_circular? -> bool (6126.0)

循環参照のチェックを行う場合は、真を返します。 そうでない場合は偽を返します。

...う場合は、真を返します。
そうでない場合は偽を返します。

//emlist[例 ネストをチェックするケース][ruby]{
require
"json"

a = [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[0]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]...
...enerate(a, s)
rescue JSON::NestingError => e
[e, s.max_nesting, s.check_circular?] # => [#<JSON::NestingError: nesting of 100 is too deep>, 100, true]
end
//}

//emlist[例 ネストをチェックしないケース][ruby]{
require
"json"

a = [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[...
...]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
s2 = JSON.state.new(max_nesting: 0)
json = JSON.generate(a, s2)
[json, s2.max_nesting, s2.check_circular?] # => ["[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[0]]]]]]]]]]]]]]]]]]]]]]]]]...

Kernel#check_sizeof(type, headers = nil) -> Integer | nil (6115.0)

与えられた型のサイズを返します。

...追加し、型のサイズを返します。型 type がシステムに
存在しない場合は、nil を返します。

例えば、

require
'mkmf'
check
_sizeof('mystruct') # => 12

である場合、SIZEOF_MYSTRUCT=12 というプリプロセッサマクロをコンパイラに渡します...

Kernel#check_sizeof(type, headers = nil) { ... } -> Integer | nil (6115.0)

与えられた型のサイズを返します。

...追加し、型のサイズを返します。型 type がシステムに
存在しない場合は、nil を返します。

例えば、

require
'mkmf'
check
_sizeof('mystruct') # => 12

である場合、SIZEOF_MYSTRUCT=12 というプリプロセッサマクロをコンパイラに渡します...

StringScanner#check_until(regexp) -> String | nil (6114.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 # => 0
s.pre_match # => "tes...

絞り込み条件を変える

OpenSSL::BN#prime_fasttest?(checks=nil, vtrivdiv=true) -> bool (107.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 判定時にエラー...

Exception#backtrace_locations -> [Thread::Backtrace::Location] (25.0)

バックトレース情報を返します。Exception#backtraceに似ていますが、 Thread::Backtrace::Location の配列を返す点が異なります。

...
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...

Exception#==(other) -> bool (19.0)

自身と指定された other のクラスが同じであり、 message と backtrace が == メソッドで比較して 等しい場合に true を返します。そうでない場合に false を返します。

...//emlist[例][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

results = [2, 2, 4].map { |e | get_exception { check_long_month(e) } }
p...

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

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

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

@param regexp マッチに用いる正規表現を指定...
...チした部分文字列を返します。
false ならばマッチした部分文字列の長さを返します。

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

s = StringScanner.new('test string')
p s.scan_full(/\w+/, 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?...
<< 1 2 > >>