Ruby - Functional Patterns in Ruby
Identify the error in the following Ruby code that tries to chain methods:
class Person
def initialize(name)
@name = name
end
def greet
puts "Hello, #{@name}!"
end
def farewell
puts "Goodbye, #{@name}!"
end
end
p = Person.new("Sam")
p.greet.farewell