Check my terminology and understanding please

Am I understanding this correctly, and are my terms correct? Thanks in
advance, and happy new year everyone!

    variable = receiver.object.method( arguments )

…or…
variable = receiver.object.send( :method, arguments )

  • variable: Result storage (an object_id returned by the method call,
    often
    nil or otherwise).

  • receiver: Who gets the message (:method), typically self. Controlled
    by
    the class of the object. Ruby looks up the class stack until it finds
    the
    method or exhausts the stack.

  • object: An instance of the class, with a unique object_id.

  • arguments: Literally, other object_ids being passed to the method.
    Can
    include strings, numbers, hashes, arrays, and blocks.

A ‘receiver’ is also an object, and your ‘object’ is also a receiver,
of a different message. But basically, yes.

I’m afraid I don’t follow. What’s the different message you speak of,
if
not :method ?

variable = receiver.object.method( arguments )

Let’s change the names so we don’t get it confused:

foo = bar.baz.quxx(quxxx)

In this code, bar receives the message baz. The result recieves the
message quxx, with the arguments quxxx. This is assigned to foo.

Does that help?

Awesome. Any time.

That makes sense, thank you!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs