Skip to content

Instantly share code, notes, and snippets.

View nicwn's full-sized avatar

Nicholas Wang nicwn

View GitHub Profile
def test_method_names_become_symbols
symbols_as_strings = Symbol.all_symbols.map { |x| x.to_s }
assert_equal true, symbols_as_strings.include?("test_method_names_become_symbols")
end
@nicwn
nicwn / ruby_koans_message_passing.rb
Created January 31, 2011 03:45
This begs for a little more explanation...
def test_methods_can_be_invoked_by_sending_the_message
mc = MessageCatcher.new
assert mc.send(:caught?) #Note: so this is the same as mc.caught?
end
def test_methods_can_be_invoked_more_dynamically #Note: or it shoudl say, calling a method is the same as sending a message to the class object.
mc = MessageCatcher.new
assert mc.send("caught?")