31 Jul 2012 20:53

## rubeque: Unidentified X Object

```Couldn't figure out how to solve this puzzle. Anyone?

http://rubeque.com/problems/unidentified-x-object

--

--
Posted via http://www.ruby-forum.com/.

```
31 Jul 2012 21:45

### Re: rubeque: Unidentified X Object

```On Tue, Jul 31, 2012 at 1:53 PM, Jingjing Duan <lists <at> ruby-forum.com> wrote:
> Couldn't figure out how to solve this puzzle. Anyone?
>
> http://rubeque.com/problems/unidentified-x-object

The name of the puzzle is a clue; think of informal names you've seen
for some of the Ruby operators.

```
31 Jul 2012 23:57

### Re: rubeque: Unidentified X Object

```Let Ruby tell you:

Fixnum.instance_methods.find_all { |op| "X" * 2.send(op,2) == "" rescue
nil}

Then repeat for the other case, and see which operator is common to
both.

--

--
Posted via http://www.ruby-forum.com/.

```
1 Aug 2012 00:49

### Re: rubeque: Unidentified X Object

```Brian Candler wrote in post #1070831:
> Let Ruby tell you:
>
> Fixnum.instance_methods.find_all { |op| "X" * 2.send(op,2) == "" rescue
> nil}
>
> Then repeat for the other case, and see which operator is common to
> both.

Good trick. Forgot the spaceship operator returns an integer instead of
a boolean...

--

--
Posted via http://www.ruby-forum.com/.

```
1 Aug 2012 01:59

### Re: rubeque: Unidentified X Object

```On Tue, Jul 31, 2012 at 6:49 PM, Jingjing Duan <lists <at> ruby-forum.com> wrote:

> Forgot the spaceship operator returns an integer instead of
> a boolean...

Booleans don't have enough values.  It has to have something for
greater, less, and equal... and despite repeated appearances on The
Daily WTF (http://thedailywtf.com), FILE_NOT_FOUND is not a valid
Boolean.

-Dave

--

--
Dave Aronson, Cleared/Remote Ruby on Rails Freelancer
(NoVa/DC/Remote); see www.DaveAronson.com, and blogs at
www.Codosaur.us, www.Dare2XL.com, www.RecruitingRants.com

```

Gmane