Skip to content

Instantly share code, notes, and snippets.

@jonasmaturana
Created September 12, 2012 13:07
Show Gist options
  • Save jonasmaturana/3706485 to your computer and use it in GitHub Desktop.
Save jonasmaturana/3706485 to your computer and use it in GitHub Desktop.
Small example of a Ruby class
class Counter
def initialize(start_value = 0)
@sum = start_value
end
def inc(x = 1)
@sum = @sum + x
end
def self.add(a, b)
a + b
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment