クラス
- Enumerator (84)
-
Enumerator
:: Lazy (60) -
Enumerator
:: Yielder (30) - Exception (24)
- Fiber (66)
-
Net
:: POP3 (12) - Object (98)
- Pathname (39)
- Proc (62)
- StopIteration (12)
- Thread (24)
モジュール
- Enumerable (100)
- Kernel (49)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) - << (12)
- == (12)
- === (12)
- Continuation (12)
- Fiber (12)
-
NEWS for Ruby 2
. 3 . 0 (10) -
NEWS for Ruby 2
. 5 . 0 (8) -
NEWS for Ruby 2
. 6 . 0 (7) -
NEWS for Ruby 2
. 7 . 0 (6) -
NEWS for Ruby 3
. 0 . 0 (5) - Proc (12)
- Ruby プログラムの実行 (12)
- Yielder (12)
- [] (24)
- alive? (12)
-
backtrace
_ locations (12) - call (12)
- compact (4)
-
create
_ makefile (12) - each (48)
-
each
_ entry (39) -
enum
_ for (48) - feed (12)
- find (24)
- foreach (12)
- lambda (18)
-
max
_ by (48) - monitor (12)
- new (26)
-
next
_ values (12) -
peek
_ values (12) - proc (19)
-
proc
_ yield (12) - raise (18)
-
rb
_ catch (12) -
rb
_ f _ loop (12) -
rb
_ iterate (12) -
rb
_ thread _ yield (12) -
rb
_ yield (12) -
rb
_ yield _ 0 (12) - rdoc (12)
- result (12)
- resume (12)
-
ruby 1
. 6 feature (12) -
ruby 1
. 9 feature (12) -
sort
_ by (24) - tap (8)
- then (14)
-
thread
_ variable _ get (12) -
to
_ enum (48) -
to
_ proc (18) - transfer (12)
-
yield
_ self (16) -
yield
_ under (12) -
yield
_ under _ i (12) - クラス/メソッドの定義 (12)
- セキュリティモデル (12)
- メソッド呼び出し(super・ブロック付き・yield) (12)
- 制御構造 (12)
- 字句構造 (12)
- 手続きオブジェクトの挙動の詳細 (12)
検索結果
先頭5件
-
Enumerator
# each(*args) { . . . } -> object (18.0) -
生成時のパラメータに従ってブロックを繰り返します。 *args を渡した場合は、生成時のパラメータ内引数末尾へ *args を追加した状態で繰り返します。 ブロック付きで呼び出された場合は、 生成時に指定したイテレータの戻り値をそのまま返します。
...o", "world"]
"Hello, world!".to_enum(:scan).each(/\w+/).to_a # => ["Hello", "world"]
obj = Object.new
def obj.each_arg(a, b=:b, *rest)
yield a
yield b
yield rest
:method_returned
end
enum = obj.to_enum :each_arg, :a, :x
enum.each.to_a # => [:a, :x, []]
enum.each.equal?(e... -
Fiber
# alive? -> bool (18.0) -
ファイバーが「生きている」時、真を返します。
...ume されていない
* ブロック内の評価が終了していない (Fiber.yield が呼ばれていない)
//emlist[例:][ruby]{
fr = Fiber.new{
Fiber.yield
"a"
}
p fr.alive? # => true
fr.resume # Fiber.yieldで戻ってくる
p fr.alive? # => true
fr.resume # ブロック内の評価... -
NEWS for Ruby 2
. 7 . 0 (18.0) -
NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...異クラス構文での yield は警告を表示するようになりました。
これは deprecated です。 15575
この警告は「-W:no-deprecated」オプションで止められます。
//emlist{
def foo
class << Object.new
yield #=> warning: `yield' in class syntax will no......enumerator を生成する
Enumerator::Lazy#eagerメソッドが追加されました。 15901
* Enumerator::Yielder#to_procメソッドが追加され、Yielder オブジェクトを
直接他のメソッドのブロック引数として渡せるようになりました。 15... -
NEWS for Ruby 3
. 0 . 0 (18.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...ith no special behavior.
C-API methods related to `$SAFE` have been removed.
16131 17136
* yield in singleton class definitions in methods is now a SyntaxError
instead of a warning. yield in a class definition outside of a method
is now a SyntaxError instead of a LocalJumpError. 1......l.rand`/`Random.rand` directly, or create a `Random` instance with `Random.new` instead. 17351
* String
* The following methods now return or yield String instances instead of subclass instances when called on subclass instances: 10845
* String#*
* String#capitalize
* String#......ects are frozen. 8948 16377 15504
//emlist[][ruby]{
/foo/.frozen? #=> true
(42...).frozen? # => true
//}
* EXPERIMENTAL: Hash#each consistently yields a 2-element array. 12706
* Now `{ a: 1 }.each(&->(k, v) { })` raises an ArgumentError due to lambda's arity check.
* When writing to STDOUT... -
ruby 1
. 9 feature (18.0) -
ruby 1.9 feature ruby version 1.9.0 は開発版です。 以下にあげる機能は将来削除されたり互換性のない仕様変更がなされるかもしれません。 1.9.1 以降は安定版です。 バグ修正がメインになります。
...1文字の String を返すようになりました
* 多重代入、引数渡し
: 多重代入や yield の何かが変わりました
: Proc#yield が導入されました
: nil.yield が導入されました。no block given (LocalJumpError) という例外を生成します
: 仮引... -
Pathname
# each _ entry -> Enumerator (16.0) -
Dir.foreach(self.to_s) {|f| yield Pathname.new(f) } と同じです。
...Dir.foreach(self.to_s) {|f| yield Pathname.new(f) } と同じです。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
require "pathname"
Pathname("/usr/local").each_entry {|f| p f }
# => #<Pathname:.>
# => #<Pathname:..>
# => #<Pathname:bin>
# => #<Pathna... -
Pathname
# each _ entry {|pathname| . . . } -> nil (16.0) -
Dir.foreach(self.to_s) {|f| yield Pathname.new(f) } と同じです。
...Dir.foreach(self.to_s) {|f| yield Pathname.new(f) } と同じです。
//emlist[例][ruby]{
require "pathname"
Pathname("/usr/local").each_entry {|f| p f }
# => #<Pathname:.>
# => #<Pathname:..>
# => #<Pathname:bin>
# => #<Pathname:etc>
# => #<Pathname:include>
# => #<Pathname:lib>
# => #<Pathna......Dir.foreach(self.to_s) {|f| yield Pathname.new(f) } と同じです。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
require "pathname"
Pathname("/usr/local").each_entry {|f| p f }
# => #<Pathname:.>
# => #<Pathname:..>
# => #<Pathname:bin>
# => #<Pathna... -
static VALUE rb
_ f _ loop(void) (16.0) -
loop の実体。永遠に yield を繰り返します。
...loop の実体。永遠に yield を繰り返します。... -
Enumerable
# each _ entry -> Enumerator (12.0) -
ブロックを各要素に一度ずつ適用します。
...が渡された場合はブロックには配列として渡されます。
//emlist[例][ruby]{
class Foo
include Enumerable
def each
yield 1
yield 1,2
end
end
Foo.new.each_entry{|o| print o, " -- "}
# => 1 -- [1, 2] --
//}
ブロックを省略した場合は Enumerator が返さ... -
Enumerable
# each _ entry {|obj| block} -> self (12.0) -
ブロックを各要素に一度ずつ適用します。
...が渡された場合はブロックには配列として渡されます。
//emlist[例][ruby]{
class Foo
include Enumerable
def each
yield 1
yield 1,2
end
end
Foo.new.each_entry{|o| print o, " -- "}
# => 1 -- [1, 2] --
//}
ブロックを省略した場合は Enumerator が返さ... -
Fiber
# resume(*arg = nil) -> object (12.0) -
自身が表すファイバーへコンテキストを切り替えます。 自身は resume を呼んだファイバーの子となります。
...m arg self が表すファイバーに渡したいオブジェクトを指定します。
@return コンテキストの切り替えの際に Fiber.yield に与えられた引数
を返します。ブロックの終了まで実行した場合はブロックの評価結果
を返し......また、Fiber#transfer を呼び出した後に resume を
呼び出した場合に発生します。
//emlist[例:][ruby]{
f = Fiber.new do
Fiber.yield(:hoge)
:fuga
end
p f.resume() #=> :hoge
p f.resume() #=> :fuga
p f.resume() #=> FiberError: dead fiber called
//}...