oop/test/str.rb

tests/_examples/oop/test/str.rb in the metorex repository.

class Person
  def initialize(name)
    @name = name
  end

  def to_s
    "Person: " + @name
  end
end

person = Person.new("Alice")
puts person

Output:

Person: Alice