getting wanked off by ruby
# Define a class named "Person"
class Person
attr_reader :name
# Define a constructor method to initialize the Person object with a name
def initialize(name)
@name = name
end
# Define a method named "massage" that takes another Person object as an argument
def massage(other_person)
"#{name} is getting a massage from #{other_person.name}"
end
end
# Create two Person objects named "ruby" and "wanker"
ruby = Person.new("Ruby")
wanker = Person.new("Wanker")
# Call the "massage" method of the "ruby" object passing the "wanker" object as an argument
puts ruby.massage(wanker)
This Ruby code defines a Person
class with an instance variable name
. It initializes two Person
objects with the names "Ruby" and "Wanker". The massage
method takes another Person
object as an argument and returns a string indicating that the person is getting a massage from another person. The code then calls the massage
method on the "ruby" object, passing the "wanker" object as an argument, and prints the resulting message.