Ruby Koans 202: Why does the correct answer give a syntax error?
- by hlh
I'm working through the about_classes.rb file in the Ruby Koans, and have hit a brick wall with the "inside_a_method_self_refers_to_the_containing_object" test. Here's the code:
class Dog7
attr_reader :name
def initialize(initial_name)
@name = initial_name
end
def get_self
self
end
def to_s
__
end
def inspect
…