------ art_3492_29416193.1195506581679
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
I have this code:
require 'test/unit'
require 'leapyear'
class LeapYearTest < Test::Unit::TestCase
def setup
@ly eapYear.new
end
def LeapYearTest.generate_tests
filename testdata.dat"
file ile.new(filename, "r")
file.each_line do |line|
year, is_leap ine.split;
code ambda { assert_equal(is_leap.downcase true", @ly.isleap?(
year.to_i)) }
define_method("test_isleap_" + year, code)
end
file.close
end
end
What I want to know is why when I use define_method("name") {block;} instead
of define_method("name", lambda{block}) the binding seems to happen later
(after the each_line loop)?
Is there a reason behind that?
Thanks,
Sammy Larbi
------ art_3492_29416193.1195506581679--