Skip to content

Instantly share code, notes, and snippets.

@tarcieri
Created October 9, 2008 05:09
Show Gist options
  • Select an option

  • Save tarcieri/15702 to your computer and use it in GitHub Desktop.

Select an option

Save tarcieri/15702 to your computer and use it in GitHub Desktop.
>> class Foo
.. def get_bar
.. @bar
.. def set_bar(val)
.. @bar = val
..
=> ~ok
>> f = Foo.start()
=> #<Object>
>> f.get_bar()
=> nil
>> f.set_bar(42)
=> 42
>> f.get_bar()
=> 42
>> class Foo
.. def get_bar
.. @bar
.. def get_baz
.. @baz
.. def set(bar, baz)
.. (@bar, @baz) = (bar, baz)
..
=> ~ok
>> f.get_bar()
=> 42
>> f.get_baz()
=> nil
>> f.set(1, 2)
=> (1,2)
>> f.get_bar()
=> 1
>> f.get_baz()
=> 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment