Skip to content

Instantly share code, notes, and snippets.

@wyodeb
Last active July 9, 2024 12:43
Show Gist options
  • Save wyodeb/4190bb2823a63128330bef08d2c6adaf to your computer and use it in GitHub Desktop.
Save wyodeb/4190bb2823a63128330bef08d2c6adaf to your computer and use it in GitHub Desktop.
class FakeNumber
def initialize(value)
@value = value
end
def +(other)
@value + other.to_i
end
def to_i
@value
end
def to_s
@value.to_s
end
end
num1 = FakeNumber.new(5)
num2 = FakeNumber.new(10)
puts num1 + num2 # Outputs: 15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment