るりまサーチ

最速Rubyリファレンスマニュアル検索!
65件ヒット [1-65件を表示] (0.115秒)
トップページ > クエリ:p[x] > クエリ:nil?[x]

別のキーワード

  1. openssl p
  2. openssl p=
  3. fileutils mkdir_p
  4. kernel p
  5. dh p

ライブラリ

クラス

モジュール

キーワード

検索結果

Object#nil? -> bool (18125.0)

レシーバが nil であれば真を返します。

...レシーバが nil であれば真を返します。

p
false.nil? #=> false
p
nil.nil? #=> true

@see NilClass...

irb/completion (6006.0)

irb の completion 機能を提供するライブラリです。

...irb の completion 機能を提供するライブラリです。

=== 使い方

$ irb -r irb/completion

とするか, ~/.irbrc 中に

require "irb/completion"

を入れてください.
irb実行中に require "irb/completion" してもよいです.

irb 実行中に [Tab] を押すとコ...
...す.

irb(main):001:0> in
in inspect instance_eval
include install_alias_method instance_of?
initialize install_aliases instance_variables
irb(main):001:0> inspect
"main"
irb(main):002:0> foo = Object.new
#<Object:0...
...tainted?
foo.display foo.is_a? foo.to_a
foo.dup foo.kind_of? foo.to_s
foo.eql? foo.method foo.type
foo.equal? foo.methods foo.untaint
foo.extend foo.nil?...

Zlib::GzipReader#ungetc(char) -> nil (3006.0)

IO クラスの同名メソッド IO#ungetc と同じです。

...ラスの同名メソッドと同じですが、gzip ファイル中に
エラーがあった場合 Zlib::Error 例外や
Zlib::GzipFile::Error 例外が発生します。

gzip ファイルのフッターの処理に注意して下さい。
gzip ファイルのフッターには圧縮前データ...
...チェックサムが
記録されています。GzipReader オブジェクトは、次の時に展開した
データとフッターの照合を行い、エラーがあった場合は
Zlib::GzipFile::NoFooter, Zlib::GzipFile::CRCError,
Zlib::GzipFile::LengthError 例外を発生させます。

*...
...gz がない場合はこれで作成する。
Zlib::GzipWriter.open('hoge.gz') { |gz|
gz.print 'hogefuga'
}
=end

Zlib::GzipReader.open('hoge.gz') { |gz|
begin
c1 = gz.getc
c2 = gz.getc
break if c2.nil?
p
rintf "%c -> %c\n", c1, c2
gz.ungetc(c2)
end w...

Timeout.#timeout(sec, exception_class = nil) {|i| ... } -> object (118.0)

ブロックを sec 秒の期限付きで実行します。 ブロックの実行時間が制限を過ぎたときは例外 Timeout::Error が発生します。

...ます。

exception_class を指定した場合には Timeout::Error の代わりに
その例外が発生します。
ブロックパラメータ i は sec がはいります。

また sec が 0 もしくは nil のときは制限時間なしで
ブロックを実行します。

@param sec タ...
...イムアウトする時間を秒数で指定します.
@param exception_class タイムアウトした時、発生させる例外を指定します.

例 長い計算のタイムアウト
require 'timeout'

def calc_pi(min)
loop do
x = rand
y = rand
x**2 + y**2 < 1.0 ? mi...
..."./loop.sh")
com = IO.popen("./loop.sh")
p
id = com.pid
while line = com.gets
p
rint line
end
}
rescue Timeout::Error => err
p
uts "timeout: shell execution."
P
rocess.kill('SIGINT', pid)
p
rintf "[result]\t%s", com.read
com.close unless com.nil?
en...
...@param exception_class タイムアウトした時、発生させる例外を指定します.
@param message エラーメッセージを指定します.省略した場合は
"execution expired" になります.

例 長い計算のタイムアウト
require 'timeout'

def calc_pi...

Timeout.#timeout(sec, exception_class, message) {|i| ... } -> object (118.0)

ブロックを sec 秒の期限付きで実行します。 ブロックの実行時間が制限を過ぎたときは例外 Timeout::Error が発生します。

...ます。

exception_class を指定した場合には Timeout::Error の代わりに
その例外が発生します。
ブロックパラメータ i は sec がはいります。

また sec が 0 もしくは nil のときは制限時間なしで
ブロックを実行します。

@param sec タ...
...@param exception_class タイムアウトした時、発生させる例外を指定します.
@param message エラーメッセージを指定します.省略した場合は
"execution expired" になります.

例 長い計算のタイムアウト
require 'timeout'

def calc_pi...
..."./loop.sh")
com = IO.popen("./loop.sh")
p
id = com.pid
while line = com.gets
p
rint line
end
}
rescue Timeout::Error => err
p
uts "timeout: shell execution."
P
rocess.kill('SIGINT', pid)
p
rintf "[result]\t%s", com.read
com.close unless com.nil?
en...

絞り込み条件を変える

Kernel.#warn(*message, uplevel: nil) -> nil (106.0)

message を 標準エラー出力 $stderr に出力します。 $VERBOSE フラグ が nil のときは何も出力しません。

...出力します。

uplevel を指定しない場合は、
このメソッドは以下と同じです。

//emlist[][ruby]{
$stderr.puts(*message) if !$VERBOSE.nil? && !message.empty?
nil
//}

@param message 出力するオブジェクトを任意個指定します。
@param uplevel いくつ前の...
...warn "caution!" # 何もしない
//}

//emlist[uplevel の例][ruby]{
def foo
warn("test message", uplevel: 0) # => test.rb:2: warning: test message
warn("test message", uplevel: 1) # => test.rb:6: warning: test message
warn("test message", uplevel: 2) # => test message
end
foo
//}


@see Wa...

Kernel.#warn(*message, uplevel: nil, category: nil) -> nil (106.0)

message を 標準エラー出力 $stderr に出力します。 $VERBOSE フラグ が nil のときは何も出力しません。

...出力します。

uplevel を指定しない場合は、
このメソッドは以下と同じです。

//emlist[][ruby]{
$stderr.puts(*message) if !$VERBOSE.nil? && !message.empty?
nil
//}

@param message 出力するオブジェクトを任意個指定します。
@param uplevel いくつ前の...
...呼び出し元のファイル名と行番号を表示するかを0以上の数値で指定します。 nil の場合は表示しません。
@param category 警告のカテゴリを指定します。サポートされている category については Warning.[] を参照してください。
@rai...
...mlist[uplevel の例][ruby]{
def foo
warn("test message", uplevel: 0) # => test.rb:2: warning: test message
warn("test message", uplevel: 1) # => test.rb:6: warning: test message
warn("test message", uplevel: 2) # => test message
end
foo
//}

//emlist[category の例][ruby]{
Warning[:deprecate...