るりまサーチ

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

別のキーワード

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

ライブラリ

クラス

モジュール

キーワード

検索結果

Object#nil? -> bool (18213.0)

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

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

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

@see NilClass...

NilClass#nil? -> bool (18207.0)

常に true を返します。

...常に true を返します。

//emlist[例][ruby]{
nil.nil? # => true
//}...

NKF (816.0)

nkf(Network Kanji code conversion Filter, https://osdn.net/projects/nkf/) を Ruby から使うためのモジュールです。

...字コード変換コマンドの例です。

//emlist[例][ruby]{
#!/usr/local/bin/ruby

require 'nkf'

opt = ''
opt = ARGV.shift if ARGV[0][0] == ?-

while line = ARGF.gets
print NKF.nkf(opt, line)
end
//}

以下は、漢字コード判別コマンドの例です。

//emlist[例][ruby]{
#!/us...
...nil) }

printf "%-10s ", file
if str.nil?
puts "EMPTY"
else
puts CODES.fetch(NKF.guess(str))
end
end
//}

=== オプション文字列

-
b 入力がバッファリングされる(デフォルト)
-
u 入力がバッファリングされない
-
j -s -e -w -w16 出力するエ...
...
-
j ISO-2022-JP (7bit JIS) を出力する(デフォルト)
-
s Shift_JIS を出力する
-
e EUC-JP を出力する
-
w UTF-8 を出力する(BOMなし)
-
w16 UTF-16 LE を出力する
-
J -S -E -W -W16 入力文字列のエンコーディングの推定値を指定する。
-
J...

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

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

...ものは実用レベルでは少ないのですが、
Socket などは DNSの名前解決に時間がかかった場合割り込めません
(resolv-replace を使用する必要があります)。
その処理を Ruby で実装しなおすか C 側で Ruby
のスレッドを意識してあげる...
...e("www.ruby-lang.org")
# (A)
}
ensure
p Time.now - start
end
# 実行例
=> ["helium.ruby-lang.org", [], 2, "210.251.121.214"]
0.689331
/usr/local/lib/ruby/1.6/timeout.rb:37: execution expired (TimeoutError)
from -:6:in `timeout'
from -:6
# get...
...id
while line = com.gets
print line
end
}
rescue Timeout::Error => err
puts "timeout: shell execution."
Process.kill('SIGINT', pid)
printf "[result]\t%s", com.read
com.close unless com.nil?
end

#止まっているか確認する。
#system("ps au")...

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

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

...ものは実用レベルでは少ないのですが、
Socket などは DNSの名前解決に時間がかかった場合割り込めません
(resolv-replace を使用する必要があります)。
その処理を Ruby で実装しなおすか C 側で Ruby
のスレッドを意識してあげる...
...e("www.ruby-lang.org")
# (A)
}
ensure
p Time.now - start
end
# 実行例
=> ["helium.ruby-lang.org", [], 2, "210.251.121.214"]
0.689331
/usr/local/lib/ruby/1.6/timeout.rb:37: execution expired (TimeoutError)
from -:6:in `timeout'
from -:6
# get...
...id
while line = com.gets
print line
end
}
rescue Timeout::Error => err
puts "timeout: shell execution."
Process.kill('SIGINT', pid)
printf "[result]\t%s", com.read
com.close unless com.nil?
end

#止まっているか確認する。
#system("ps au")...

絞り込み条件を変える

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

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

...字列に変換してから出力します。

このメソッドは以下と同じです。

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

@param message 出力するオブジェクトを任意個指定します。
@raise IOError 標準エラー出力が書...

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 いくつ前の呼び出し...

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 いくつ前の呼び出し...

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

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

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

#=> h -> o
#=> o -> g
#=> g -> e
#=> e -> f
#=> f -> u
#=> u -> g
#=> g -> a

@see IO#ungetc...

rss (78.0)

RSS を扱うためのライブラリです。

...す。

=== 参考

* RSS 0.91 http://backend.userland.com/rss091
* RSS 1.0 http://purl.org/rss/1.0/spec
* RSS 2.0 http://www.rssboard.org/rss-specification
* Atom 1.0 https://www.ietf.org/rfc/rfc4287.txt

=== 注意

RSS ParserはRSS 0.9x/1.0/2.0, Atom 1.0 をサポートしています...
...を作成する

* 出力エンコーディングを指定する(省略可)

* RSSオブジェクトのto_sメソッドを呼ぶ

==== xml-stylesheet

xml-stylesheetも出力することができます.

RSSのルート要素(RSS::RDFまたはRSS::Rss)オブジェ
クトおよびAtomのル...
...ARGV.each do |fname|
feed = nil
begin
feed = RSS::Parser.parse(File.read(fname), false)
rescue RSS::Error
end

if feed.nil?
puts "#{fname}はRSS 0.9x/1.0/2.0, Atom 1.0のいずれでもありません。"
else
print_items(feed)
end
end

あとはpri...

絞り込み条件を変える

irb/completion (12.0)

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

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

=== 使い方

$ irb -r irb/completion

とするか, ~/.irbrc 中に

require "irb/completion"

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

irb 実行中に [Tab] を押すとコ...
...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?
foo.freeze foo.private_methods...