Skip to content

Instantly share code, notes, and snippets.

@lak
Created July 6, 2009 05:16
Show Gist options
  • Select an option

  • Save lak/141272 to your computer and use it in GitHub Desktop.

Select an option

Save lak/141272 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
class Metric
def +(value)
self.class.new(@value + value.to_i)
end
def initialize(value = 0)
@value = value
end
end
zero = Metric.new
p zero
p zero += 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment