680件ヒット
[1-100件を表示]
(0.035秒)
別のキーワード
クラス
- CSV (36)
- Date (24)
-
Encoding
:: Converter (12) - Enumerator (78)
- Float (22)
- Integer (36)
- Object (30)
-
Prime
:: EratosthenesGenerator (36) -
REXML
:: Child (24) -
REXML
:: Element (12) -
RubyVM
:: InstructionSequence (36) - String (48)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) - >> (12)
- Enumerator (12)
-
NEWS for Ruby 2
. 0 . 0 (12) -
NEWS for Ruby 2
. 2 . 0 (11) -
NEWS for Ruby 2
. 7 . 0 (6) -
NEWS for Ruby 3
. 0 . 0 (5) - Numeric (12)
- Proc (12)
- Ruby プログラムの実行 (12)
- debug (12)
- disasm (12)
- disassemble (12)
- feed (12)
- filter (36)
- lambda (18)
- load (15)
- loop (20)
- next! (12)
-
next
_ element (12) -
next
_ float (11) -
next
_ sibling= (12) -
next
_ values (12) -
next
_ year (12) - parse (12)
- peek (12)
-
peek
_ values (12) - pred (12)
-
prev
_ float (11) -
previous
_ sibling= (12) -
primitive
_ errinfo (12) - proc (19)
- produce (6)
- rewind (24)
-
rexml
/ parsers / pullparser (12) -
ruby 1
. 8 . 4 feature (12) - succ (36)
- succ! (12)
- then (14)
-
to
_ a (12) -
yield
_ self (16) - プログラム・文・式 (12)
- メソッド呼び出し(super・ブロック付き・yield) (12)
- リテラル (12)
- 制御構造 (12)
- 字句構造 (12)
- 手続きオブジェクトの挙動の詳細 (12)
検索結果
先頭5件
-
Enumerator
# next -> object (18155.0) -
「次」のオブジェクトを返します。
...合は、
StopIteration 例外を発生します。このとき列挙状態は変化しません。
つまりもう一度 next を呼ぶと再び例外が発生します。
next メソッドによる外部列挙の状態は他のイテレータメソッドによる
内部列挙には影響を与え......とき
@see Enumerator#rewind
//emlist[例1][ruby]{
str = "xyz"
enum = str.each_byte
str.bytesize.times do
puts enum.next
end
# => 120
# 121
# 122
//}
//emlist[例2][ruby]{
str = "xyz"
enum = str.each_byte
begin
puts enum.next while true
rescue StopIteration
puts "iterati......121
# 122
# iteration reached at end
puts enum.next
#=> 再度 StopIteration 例外が発生
//}
//emlist[例3: Kernel.#loop は StopIteration を捕捉します。][ruby]{
str = "xyz"
enum = str.each_byte
loop do
puts enum.next
end
# => 120
# 121
# 122
//}... -
String
# next -> String (18131.0) -
self の「次の」文字列を返します。
...して計算されます。
//emlist[][ruby]{
p "aa".succ # => "ab"
p "88".succ.succ # => "90"
//}
"99" → "100", "AZZ" → "BAA" のような繰り上げも行われます。
このとき負符号などは考慮されません。
//emlist[][ruby]{
p "99".succ # => "100"
p "ZZ".succ......なり、残りは保存されます。
//emlist[][ruby]{
p "1.9.9".succ # => # "2.0.0"
//}
逆に self がアルファベットや数字をまったく含まない場合は、
単純に文字コードを 1 増やします。
//emlist[][ruby]{
p ".".succ # => "/"
//}
さらに、self が空......お、succ と逆の動作をするメソッドはありません。
また、succ という名前の由来は successor です。
//emlist[例][ruby]{
p "aa".succ # => "ab"
# 繰り上がり
p "99".succ # => "100"
p "a9".succ # => "b0"
p "Az".succ # => "Ba"
p "zz".succ # => "aaa"
p "-9... -
Prime
:: EratosthenesGenerator # next -> Integer (18125.0) -
次の(擬似)素数を返します。なお、この実装においては擬似素数は真に素数です。
...いては擬似素数は真に素数です。
また内部的な列挙位置を進めます。
//emlist[例][ruby]{
require 'prime'
generator = Prime::EratosthenesGenerator.new
p generator.next #=> 2
p generator.next #=> 3
p generator.succ #=> 5
p generator.succ #=> 7
p generator.next #=> 11
//}... -
Integer
# next -> Integer (18119.0) -
self の次の整数を返します。
...self の次の整数を返します。
//emlist[][ruby]{
1.next #=> 2
(-1).next #=> 0
1.succ #=> 2
(-1).succ #=> 0
//}
@see Integer#pred... -
Enumerator
# next _ values -> Array (6209.0) -
「次」のオブジェクトを配列で返します。
...を配列で返します。
Enumerator#next とほぼ同様の挙動をします。終端まで到達した場合は
StopIteration 例外を発生させます。
このメソッドは、
yield
と
yield nil
を区別するために使えます。
next メソッドによる外部列挙の状......list[例: next と next_values の違いを][ruby]{
o = Object.new
def o.each
yield
yield 1
yield 1, 2
yield nil
yield [1, 2]
end
e = o.to_enum
p e.next_values
p e.next_values
p e.next_values
p e.next_values
p e.next_values
e = o.to_enum
p e.next
p e.next
p e.next
p e.next
p e.next
## yie......ld args next_values next
# yield [] nil
# yield 1 [1] 1
# yield 1, 2 [1, 2] [1, 2]
# yield nil [nil] nil
# yield [1, 2] [[1, 2]] [1, 2]
//}
@raise StopIteration 列挙状態が既に最後... -
Float
# next _ float -> Float (6167.0) -
浮動小数点数で表現可能な self の次の値を返します。
....next_float、Float::INFINITY.next_float は
Float::INFINITY を返します。Float::NAN.next_float は
Float::NAN を返します。
//emlist[例][ruby]{
p 0.01.next_float # => 0.010000000000000002
p 1.0.next_float # => 1.0000000000000002
p 100.0.next_float # => 100.00000000000001
p 0.01.next......_float - 0.01 # => 1.734723475976807e-18
p 1.0.next_float - 1.0 # => 2.220446049250313e-16
p 100.0.next_float - 100.0 # => 1.4210854715202004e-14
f = 0.01; 20.times { printf "%-20a %s\n", f, f.to_s; f = f.next_float }
# => 0x1.47ae147ae147bp-7 0.01
# 0x1.47ae147ae147cp-7 0.0100000000000000... -
Date
# next _ year(n = 1) -> Date (6125.0) -
n 年後を返します。
...ます。
self >> (n * 12) に相当します。
//emlist[例][ruby]{
require 'date'
Date.new(2001,2,3).next_year #=> #<Date: 2002-02-03 ...>
Date.new(2008,2,29).next_year #=> #<Date: 2009-02-28 ...>
Date.new(2008,2,29).next_year(4) #=> #<Date: 2012-02-29 ...>
//}
Date#>> も参照し... -
REXML
:: Element # next _ element -> Element | nil (6119.0) -
次の兄弟要素を返します。
...次の兄弟要素を返します。
次の要素が存在しない場合は nil を返します。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new '<a><b/>text<c/></a>'
doc.root.elements['b'].next_element # => <c/>
doc.root.elements['c'].next_element # => nil
//}... -
REXML
:: Child # next _ sibling=(other) (6113.0) -
other を self の次の隣接ノードとします。
...f の後ろに
other を挿入します。
@param other 挿入するノード
//emlist[][ruby]{
require 'rexml/document'
a = REXML::Element.new("a")
b = a.add_element("b")
c = REXML::Element.new("c")
b.next_sibling = c
d = REXML::Element.new("d")
b.previous_sibling = d
p a.to_s # => "<a><d/><b/>...