diff options
author | Tanaka Akira <akr@fsij.org> | 2019-07-14 22:04:27 +0900 |
---|---|---|
committer | Tanaka Akira <akr@fsij.org> | 2019-07-14 22:04:27 +0900 |
commit | b7ec77f3614d7a89a47466f240d53abc0f967d19 (patch) | |
tree | bab026ba4832a02f89ade40b96179c3b221389c0 /proc.c | |
parent | 085d0e5ccb7cecb1f761c1d3c72caeeedafc7d04 (diff) | |
download | ruby-b7ec77f3614d7a89a47466f240d53abc0f967d19.tar.gz |
fix typos.
Diffstat (limited to 'proc.c')
-rw-r--r-- | proc.c | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -3423,7 +3423,7 @@ rb_method_compose_to_right(VALUE self, VALUE g) * $a = []; def m1(&b) b.call; $a << :m1 end; def m2() m1(&proc { next }); $a << :m2 end; m2; p $a * #=> [:m1, :m2] * - * # +return+, +break+ and +next+ in the subby lambda exits the block. + * # +return+, +break+ and +next+ in the stubby lambda exits the block. * # (+lambda+ method behaves same.) * # (The block is given for stubby lambda syntax and embraced by +m2+.) * $a = []; def m1(&b) b.call; $a << :m1 end; def m2() m1(&-> { return }); $a << :m2 end; m2; p $a @@ -3510,18 +3510,19 @@ rb_method_compose_to_right(VALUE self, VALUE g) * a proc by the <code>&</code> operator, and therefore con be * consumed by iterators. * - * class Greater - * def initialize(greating) - * @greating = greating + + * class Greeter + * def initialize(greeting) + * @greeting = greeting * end * * def to_proc - * proc {|name| "#{@greating}, #{name}!" } + * proc {|name| "#{@greeting}, #{name}!" } * end * end * - * hi = Greater.new("Hi") - * hey = Greater.new("Hey") + * hi = Greeter.new("Hi") + * hey = Greeter.new("Hey") * ["Bob", "Jane"].map(&hi) #=> ["Hi, Bob!", "Hi, Jane!"] * ["Bob", "Jane"].map(&hey) #=> ["Hey, Bob!", "Hey, Jane!"] * @@ -3557,7 +3558,7 @@ rb_method_compose_to_right(VALUE self, VALUE g) * def m1(&b) b end; def m2(); m1 { return } end; m2.call # LocalJumpError * def m1(&b) b end; def m2(); m1 { break } end; m2.call # LocalJumpError * - * Since +return+ and +break+ exists the block itself in lambdas, + * Since +return+ and +break+ exits the block itself in lambdas, * lambdas cannot be orphaned. * */ |