るりまサーチ

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

別のキーワード

  1. _builtin -
  2. open-uri open
  3. irb/input-method gets
  4. irb/input-method new
  5. matrix -

検索結果

<< < ... 2 3 4 >>

OpenSSL::BN#prime? -> bool (125.0)

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

...であるなら true を返します。

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

@param check Miller-Robin 法の繰り返しの回数
@raise OpenSSL...

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

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

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

Socket#connect_nonblock(server_sockaddr) -> 0 (113.0)

ソケットをノンブロッキングモードに設定した後、 connect(2) を呼び出します。

...connect
socket.connect_nonblock(sockaddr)
rescue IO::WaitWritable
IO.select(nil, [socket]) # wait 3-way handshake completion
begin
socket.connect_nonblock(sockaddr) # check connection failure
rescue Errno::EISCONN
end
end
socket.write("GET / HTTP/1.0\r\n\r\n")
resul...

StringScanner#scan_full(regexp, s, f) -> object (113.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 マッチに用いる正規表現を指定...
...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 (113.0)

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

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

@param regexp マッチに用いる正規表現...
...tringScanner.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?...

絞り込み条件を変える

BasicSocket#getpeereid -> [Integer, Integer] (107.0)

Unix ドメインソケットにおいて接続相手の euid と egid を 返します。

...り値は
不定です。

require 'socket'

Socket.unix_server_loop("/tmp/sock") {|s|
begin
euid, egid = s.getpeereid

# Check the connected client is myself or not.
next if euid != Process.uid

# do something about my resource.
ensure
s.close...

Module#ruby2_keywords(method_name, ...) -> nil (107.0)

For the given method names, marks the method as passing keywords through a normal argument splat. This should only be called on methods that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the method such that if the method is called with keyword arguments, the final hash argument is marked with a special flag such that if it is the final element of a normal argument splat to another method call, and that method call does not include explicit keywords or a keyword splat, the final element is interpreted as keywords. In other words, keywords will be passed through the method to other methods.

...his method will probably be removed at some point, as it exists only
for backwards compatibility. As it does not exist in Ruby versions
before 2.7, check that the module responds to this method before calling
it. Also, be aware that if this method is removed, the behavior of the
method will change s...

Proc#ruby2_keywords -> proc (107.0)

Marks the proc as passing keywords through a normal argument splat. This should only be called on procs that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the proc such that if the proc is called with keyword arguments, the final hash argument is marked with a special flag such that if it is the final element of a normal argument splat to another method call, and that method call does not include explicit keywords or a keyword splat, the final element is interpreted as keywords. In other words, keywords will be passed through the proc to other methods.

...exist in Ruby versions
before 2.7, check that the proc responds to this method before calling
it. Also, be aware that if this method is removed, the behavior of the
proc will change so that it does not pass through keywords.

//emlist[][ruby]{
module Mod
foo = ->(meth, *args, &block) do
send(...

FileUtils#sh(*cmd) {|result, status| ... } (13.0)

与えられたコマンドを実行します。

...行します。

@param cmd 引数の解釈に関しては Kernel.#exec を参照してください。


例:
sh %{ls -ltr}

sh 'ls', 'file with spaces'

# check exit status after command runs
sh %{grep pattern file} do |ok, res|
if ! ok
puts "pattern not found (status...
<< < ... 2 3 4 >>