Hi, I’m new to Ruby, on my second day now, and I love the language so
far, but there’s one problem. The documentation I’ve found so far is
pretty incomplete or at least hard to find info in. Is there a real Ruby
reference out there on the web? I’ve got the Ruby manual, and I’ve
checked out the “book” at rubycentral.com, but it’s all incomplete.
The pickaxe book is widely considered to be the best introductory and
reference material available in English…
For instance, what errors will File.new throw? When exactly does Ruby
pass by reference and when does it copy the object?
All objects but Fixnum (and you don’t see the difference because there’s
no “mutator” methods defined in that class and you cannot define singleton
methods for it) and Float (not sure about the latter). Maybe I forget
something, but anyway, in practice, all objects.
If you return an
object from a function, does it copy that object, or does it return a
reference?
a reference
If it returns a reference like I think it does, does that
provide the calling function with access to write to the returned object?
You can use methods that modify the internal state of the object.
class Foo
def initialize
@foo = “a”
end
def foo
return @foo
end
end
a = Foo.new
puts a.foo # a
b = a.foo
b << “b”
puts a.foo # ab
If there’s a book out there I should buy, please let me know.
rubycentral.com looks like a decent introduction to the language, but I
need something a little more solid. Thanks in advance for your
recommendations ![:slight_smile: :slight_smile:](https://emoji.discourse-cdn.com/twitter/slight_smile.png?v=12)
If you don’t like it, you’re different from most of us ![:stuck_out_tongue: :stuck_out_tongue:](https://emoji.discourse-cdn.com/twitter/stuck_out_tongue.png?v=12)
···
On Tue, May 20, 2003 at 03:10:35PM +0900, Dave wrote:
–
_ _
__ __ | | ___ _ __ ___ __ _ _ __
'_ \ / | __/ __| '_
_ \ / ` | ’ \
) | (| | |__ \ | | | | | (| | | | |
.__/ _,|_|/| || ||_,|| |_|
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com
…[Linux’s] capacity to talk via any medium except smoke signals.
– Dr. Greg Wettstein, Roger Maris Cancer Center