Assert_equal ([:r, :u, :b, :e, :q, :u, :e] __), [:b, :q]

This is part of a online ruby quiz. Just doing it for my own
education, not on a test that I'm graded on.

assert_equal ([:r, :u, :b, :e, :q, :u, :e] __), [:b, :q]

I don't understand the above because the blank is not right up against
the [:r, :u, :b, :e, :q, :u, :e] array. I'm not sure how to search
for whatever is supposed to be in the blank.

If someone could give me a hint rather than an answer it would be appreciated.

···

--
Doubt is not a pleasant condition, but certainty is absurd.
-- Voltaire

Hey David,

Perhaps it has to do with certain operations that you can do with arrays in
Ruby ... Remember that Ruby provides syntactic sugar for certain kinds of
methods ... So, for e.g

def name= (name)
  @name = name
end

can be invoked as

<some_object>.name = "David"

What Ruby does here is that it sees an assignment (name = "David") and
looks for a method called name= (Note there is no whitespace between name
and "=").

I bring this up b/c it seems that you are thinking of a method that you
could use here ("I don't understand the above because the blank is not
right up against
the .. array"). And the solution lies in invoking a method on an array, but
with the syntactic sugar applied.

Look at Class: Array (Ruby 1.9.3) and look at any
mathematical operators that might come in handy - see how they are to be
used.

Hope that helps.

Raju

···

On Tue, May 1, 2012 at 2:55 PM, David Gustafson <daveg@radicalskeptic.net>wrote:

This is part of a online ruby quiz. Just doing it for my own
education, not on a test that I'm graded on.

assert_equal ([:r, :u, :b, :e, :q, :u, :e] __), [:b, :q]

I don't understand the above because the blank is not right up against
the [:r, :u, :b, :e, :q, :u, :e] array. I'm not sure how to search
for whatever is supposed to be in the blank.

If someone could give me a hint rather than an answer it would be
appreciated.

--
Doubt is not a pleasant condition, but certainty is absurd.
        -- Voltaire

Just the kind of pointer I was hoping for. Thanks.

···

On Tue, May 1, 2012 at 12:12 PM, Raju Gandhi <raju.gandhi@gmail.com> wrote:

Hey David,

Perhaps it has to do with certain operations that you can do with arrays in
Ruby ... Remember that Ruby provides syntactic sugar for certain kinds of
methods ... So, for e.g

def name= (name)
@name = name
end

can be invoked as

<some_object>.name = "David"

What Ruby does here is that it sees an assignment (name = "David") and looks
for a method called name= (Note there is no whitespace between name and
"=").

I bring this up b/c it seems that you are thinking of a method that you
could use here ("I don't understand the above because the blank is not right
up against
the .. array"). And the solution lies in invoking a method on an array, but
with the syntactic sugar applied.

Look at Class: Array (Ruby 1.9.3) and look at any
mathematical operators that might come in handy - see how they are to be
used.

Hope that helps.

Raju

On Tue, May 1, 2012 at 2:55 PM, David Gustafson <daveg@radicalskeptic.net> > wrote:

This is part of a online ruby quiz. Just doing it for my own
education, not on a test that I'm graded on.

assert_equal ([:r, :u, :b, :e, :q, :u, :e] __), [:b, :q]

I don't understand the above because the blank is not right up against
the [:r, :u, :b, :e, :q, :u, :e] array. I'm not sure how to search
for whatever is supposed to be in the blank.

If someone could give me a hint rather than an answer it would be
appreciated.

--
Doubt is not a pleasant condition, but certainty is absurd.
-- Voltaire

--
Doubt is not a pleasant condition, but certainty is absurd.
-- Voltaire

You are welcome :slight_smile:

···

On Tue, May 1, 2012 at 4:33 PM, David Gustafson <daveg@radicalskeptic.net>wrote:

Just the kind of pointer I was hoping for. Thanks.

On Tue, May 1, 2012 at 12:12 PM, Raju Gandhi <raju.gandhi@gmail.com> > wrote:
> Hey David,
>
> Perhaps it has to do with certain operations that you can do with arrays
in
> Ruby ... Remember that Ruby provides syntactic sugar for certain kinds of
> methods ... So, for e.g
>
> def name= (name)
> @name = name
> end
>
> can be invoked as
>
> <some_object>.name = "David"
>
> What Ruby does here is that it sees an assignment (name = "David") and
looks
> for a method called name= (Note there is no whitespace between name and
> "=").
>
> I bring this up b/c it seems that you are thinking of a method that you
> could use here ("I don't understand the above because the blank is not
right
> up against
> the .. array"). And the solution lies in invoking a method on an array,
but
> with the syntactic sugar applied.
>
> Look at http://www.ruby-doc.org/core-1.9.3/Array.html and look at any
> mathematical operators that might come in handy - see how they are to be
> used.
>
> Hope that helps.
>
> Raju
>
> On Tue, May 1, 2012 at 2:55 PM, David Gustafson < > daveg@radicalskeptic.net> > > wrote:
>>
>> This is part of a online ruby quiz. Just doing it for my own
>> education, not on a test that I'm graded on.
>>
>> assert_equal ([:r, :u, :b, :e, :q, :u, :e] __), [:b, :q]
>>
>> I don't understand the above because the blank is not right up against
>> the [:r, :u, :b, :e, :q, :u, :e] array. I'm not sure how to search
>> for whatever is supposed to be in the blank.
>>
>> If someone could give me a hint rather than an answer it would be
>> appreciated.
>>
>> --
>> Doubt is not a pleasant condition, but certainty is absurd.
>> -- Voltaire
>>
>

--
Doubt is not a pleasant condition, but certainty is absurd.
        -- Voltaire