Created
October 9, 2008 05:09
-
-
Save tarcieri/15702 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| >> 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