るりまサーチ

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

別のキーワード

  1. _builtin >
  2. bigdecimal >
  3. integer >
  4. float >
  5. module >

ライブラリ

クラス

モジュール

オブジェクト

キーワード

検索結果

<< < ... 2 3 4 >>

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

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

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

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

@param message 出力するオブジェクトを任意個指定します。
@param uplevel いくつ前の呼び出し元のファイル...
...!" #=> caution!
$VERBOSE = nil
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...
...//}

//emlist[category の例][ruby]{
Warning[:deprecated] = true # 非推奨の警告を表示する
warn("deprecated!!", category: :deprecated)
# => deprecated!

Warning[:deprecated] = false # 非推奨の警告を表示しない
warn("deprecated!!", category: :deprecated)
# 警告は出力され...

MiniTest::Assertions#assert_empty(object, message = nil) -> true (206.0)

与えられたオブジェクトが空である場合、検査にパスしたことになります。

...roc である場合は Proc#call した
結果を使用します。

@raise MiniTest::Assertion 与えられたオブジェクトが empty? メソッドを持たない場合に発生します。
また、与えられたオブジェクトが空でない場合...

Object#must_be_empty -> true (206.0)

自身が空である場合、検査にパスしたことになります。

...自身が空である場合、検査にパスしたことになります。

@raise MiniTest::Assertion 自身が empty? メソッドを持たない場合に発生します。
また、自身が空でない場合にも発生します。

@see MiniTest::Assertions#assert_e...

Object#pretty_print_cycle(pp) -> () (206.0)

プリティプリント時にオブジェクトの循環参照が検出された場合、 Object#pretty_print の代わりに呼ばれるメソッドです。

...の pp の出力をカスタマイズしたい場合は、
このメソッドも再定義する必要があります。

@param pp PP オブジェクトです。

//emlist[][ruby]{
class Array
def pretty_print_cycle(q)
q.text(empty? ? '[]' : '[...]')
end
end
//}

@see Object#pretty_print...

ThreadsWait#next_wait(nonblock = nil) -> Thread (206.0)

指定したスレッドのどれかが終了するまで待ちます。

...rue でかつ、キューが空の時、発生します。

#使用例
require 'thwait'

threads = []
2.times {|i|
threads << Thread.new { sleep i }
}

thall = ThreadsWait.new
thall.join_nowait(*threads)
until thall.empty?
th = thall.next_wait
p th
end

@see Queue#pop...

絞り込み条件を変える

pp (42.0)

オブジェクトなどを見やすく出力するためのライブラリです。

...y-print されてない出力:
#<PP:0x81a0d10 @stack=[], @genspace=#<Proc:0x81a0cc0>, @nest=[0], @newline="\n",
@buf=#<PrettyPrint::Group:0x81a0c98 @group=0, @tail=0, @buf=[#<PrettyPrint::Gro
up:0x81a0ba8 @group=1, @tail=0, @buf=[#<PrettyPrint::Text:0x81a0b30 @tail=2, @wi
dth=1, @text="[">,...
...:0x81a09f0 @tail=1, @width=1, @text="1">], @singleline_width=1>, #
<PrettyPrint::Text:0x81a0a7c @tail=0, @width=1, @text=",">, #<PrettyPrint::Break
able:0x81a0a2c @group=2, @gensace=#<Proc:0x81a0cc0>, @newline="\n", @indent=1, @
tail=2, @sep=" ", @width=1>, #<PrettyPrint::Group:0x81a09c8 @grou...
...ize > 10
q.pp(v[0..9] + '...')
else
q.pp v
end
end
first = false
}
end
q.breakable
q.text "</hash>"
end

def pretty_print_cycle(q)
q.text(empty? ? '{}' : '{...}')
end
end

h = {:a => 'a'*5, :b => 'b'*10, :c => 'c...

制御構造 (36.0)

制御構造 条件分岐: * if * unless * case 繰り返し: * while * until * for * break * next * redo * retry 例外処理: * raise * begin その他: * return * BEGIN * END

...めとする制御構造をクラス設計者が定義する事が出来るものです.

=== 条件分岐
====[a:if] if

//emlist[例][ruby]{
if age >= 12 then
print "adult fee\n"
else
print "child fee\n"
end
gender = if foo.gender == "male" then "male" else "female" end
//}

文法:...
...はその引数になります。


====[a:next] next

//emlist[例][ruby]{
# 空行を捨てるcat
ARGF.each_line do |line|
next if line.strip.empty?
print line
end
//}

文法:

next

next val


nextはもっとも内側のループの次の繰り返しにジャンプしま...
...ます。

//emlist[][ruby]{
def iter
# (a)
# :
# (b)
yield
# (c)
# :
# (d)
end
iter { redo } # -> (b) へ飛ぶ
iter { next } # -> (c) へ飛ぶ
iter { break } # -> (d) へ飛ぶ
//}

(a) は、厳密には引数評価から始まります。(b) はブロック実行の直前...
<< < ... 2 3 4 >>