1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/spec/ruby/language/fixtures/yield.rb
2019-04-27 18:53:23 +02:00

41 lines
541 B
Ruby

module YieldSpecs
class Yielder
def z
yield
end
def ze(&block)
block = proc { block }
yield
end
def s(a)
yield(a)
end
def m(a, b, c)
yield(a, b, c)
end
def r(a)
yield(*a)
end
def k(a)
yield(*a, b: true)
end
def rs(a, b, c)
yield(a, b, *c)
end
def self.define_deep(&inned_block)
define_method 'deep' do |v|
# should yield to inner_block
yield v
end
end
define_deep { |v| v * 2}
end
end