ブロックを関数に渡し、次のようにいくつかの追加パラメーターを指定してそのブロックを呼び出します。
def foo(&block)
  some_array = (1..3).to_a
  x = 7 # Simplified
  result = some_array.map &block # Need some way to pass in 'x' here
end
def a_usage_that_works
  foo do |value|
    value
  end
end
def a_usage_that_doesnt_work
  foo do |value, x|
    x # How do I pass in x?
  end
end
# rspec to demonstrate problem / required result
describe "spike" do
  it "works" do
    a_usage_that_works.should == [1,2,3]
  end
  it "doesn't work" do
    a_usage_that_doesnt_work.should == [7, 7, 7]
  end
end
追加のパラメーターをブロックに渡すにはどうすればよいですか?