From: Glen Holcomb on
[Note: parts of this message were removed to make it a legal post.]

Okay so when I play with "!".."~" wrong things happen.

("!".."~").include?("W")
true

("!.."~").include?(" ")
false

so far so good, however.

("!".."~").each do |c|
puts c
end

!
"
#
$
%
&
'
(
)
*
+
,
-
From: Robert Klemme on
2008/7/2 Glen Holcomb <damnbigman(a)gmail.com>:
> Okay so when I play with "!".."~" wrong things happen.
>
> ("!".."~").include?("W")
> true
>
> ("!.."~").include?(" ")
> false
>
> so far so good, however.
>
> ("!".."~").each do |c|
> puts c
> end
>
> !
> "
> #
> $
> %
> &
> '
> (
> )
> *
> +
> ,
> -
> .
> /
> 0
> 1
> 2
> 3
> 4
> 5
> 6
> 7
> 8
> 9
> => "!".."~"
>
> This is wrong!
>
> ("!".."~").last
> => "~"
>
> This is also right.
>
> It looks to me like a problem with the Enumerable mixin but I guess the
> question is why?

Note this

irb(main):003:0> "9".succ
=> "10"

Try this instead:

(?!..?~).each {|c| p c.chr}

irb(main):008:0> (?!..?~).include? ?\
=> false


Kind regards

robert



--
use.inject do |as, often| as.you_can - without end

From: Glen Holcomb on
[Note: parts of this message were removed to make it a legal post.]

On Wed, Jul 2, 2008 at 9:12 AM, Robert Klemme <shortcutter(a)googlemail.com>
wrote:

> 2008/7/2 Glen Holcomb <damnbigman(a)gmail.com>:
> > Okay so when I play with "!".."~" wrong things happen.
> >
> > ("!".."~").include?("W")
> > true
> >
> > ("!.."~").include?(" ")
> > false
> >
> > so far so good, however.
> >
> > ("!".."~").each do |c|
> > puts c
> > end
> >
> > !
> > "
> > #
> > $
> > %
> > &
> > '
> > (
> > )
> > *
> > +
> > ,
> > -
> > .
> > /
> > 0
> > 1
> > 2
> > 3
> > 4
> > 5
> > 6
> > 7
> > 8
> > 9
> > => "!".."~"
> >
> > This is wrong!
> >
> > ("!".."~").last
> > => "~"
> >
> > This is also right.
> >
> > It looks to me like a problem with the Enumerable mixin but I guess the
> > question is why?
>
> Note this
>
> irb(main):003:0> "9".succ
> => "10"
>
> Try this instead:
>
> (?!..?~).each {|c| p c.chr}
>
> irb(main):008:0> (?!..?~).include? ?\
> => false
>
>
> Kind regards
>
> robert
>
>
>
> --
> use.inject do |as, often| as.you_can - without end
>
>
Thanks Robert,

That is interesting. I wonder why it doesn't work as you would expect. The
range object seems to be correct (at least through limited include? testing)
however it returns incomplete info whenever you use an Enumerable method or
a method that appears to use an Enumerable method.

--
"Hey brother Christian with your high and mighty errand, Your actions speak
so loud, I can't hear a word you're saying."

-Greg Graffin (Bad Religion)

From: David A. Black on
Hi --

On Thu, 3 Jul 2008, Glen Holcomb wrote:

> On Wed, Jul 2, 2008 at 9:12 AM, Robert Klemme <shortcutter(a)googlemail.com>
> wrote:
>
>> 2008/7/2 Glen Holcomb <damnbigman(a)gmail.com>:
>>> Okay so when I play with "!".."~" wrong things happen.
>>>
>>> ("!".."~").include?("W")
>>> true
>>>
>>> ("!.."~").include?(" ")
>>> false
>>>
>>> so far so good, however.
>>>
>>> ("!".."~").each do |c|
>>> puts c
>>> end
>>>
>>> !
>>> "
>>> #
>>> $
>>> %
>>> &
>>> '
>>> (
>>> )
>>> *
>>> +
>>> ,
>>> -
>>> .
>>> /
>>> 0
>>> 1
>>> 2
>>> 3
>>> 4
>>> 5
>>> 6
>>> 7
>>> 8
>>> 9
>>> => "!".."~"
>>>
>>> This is wrong!
>>>
>>> ("!".."~").last
>>> => "~"
>>>
>>> This is also right.
>>>
>>> It looks to me like a problem with the Enumerable mixin but I guess the
>>> question is why?
>>
>> Note this
>>
>> irb(main):003:0> "9".succ
>> => "10"
>>
>> Try this instead:
>>
>> (?!..?~).each {|c| p c.chr}
>>
>> irb(main):008:0> (?!..?~).include? ?\
>> => false
>>
> Thanks Robert,
>
> That is interesting. I wonder why it doesn't work as you would expect. The
> range object seems to be correct (at least through limited include? testing)
> however it returns incomplete info whenever you use an Enumerable method or
> a method that appears to use an Enumerable method.

In 1.9 you get this:

>> ('!'..'~').to_a
=> ["!", "\"", "#", "$", "%", "&", "'", "(", ")", "*", "+", ",", "-",
".", "/", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ":", ";",
"<", "=", ">", "?", "@", "A", "B", "C", "D", "E", "F", "G", "H", "I",
"J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W",
"X", "Y", "Z", "[", "\\", "]", "^", "_", "`", "a", "b", "c", "d", "e",
"f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s",
"t", "u", "v", "w", "x", "y", "z", "{", "|", "}", "~"]


David

--
Rails training from David A. Black and Ruby Power and Light:
Intro to Ruby on Rails July 21-24 Edison, NJ
Advancing With Rails August 18-21 Edison, NJ
See http://www.rubypal.com for details and updates!

From: Glen Holcomb on
[Note: parts of this message were removed to make it a legal post.]

On Wed, Jul 2, 2008 at 10:34 AM, David A. Black <dblack(a)rubypal.com> wrote:

> Hi --
>
>
> On Thu, 3 Jul 2008, Glen Holcomb wrote:
>
> On Wed, Jul 2, 2008 at 9:12 AM, Robert Klemme <shortcutter(a)googlemail.com
>> >
>> wrote:
>>
>> 2008/7/2 Glen Holcomb <damnbigman(a)gmail.com>:
>>>
>>>> Okay so when I play with "!".."~" wrong things happen.
>>>>
>>>> ("!".."~").include?("W")
>>>> true
>>>>
>>>> ("!.."~").include?(" ")
>>>> false
>>>>
>>>> so far so good, however.
>>>>
>>>> ("!".."~").each do |c|
>>>> puts c
>>>> end
>>>>
>>>> !
>>>> "
>>>> #
>>>> $
>>>> %
>>>> &
>>>> '
>>>> (
>>>> )
>>>> *
>>>> +
>>>> ,
>>>> -
>>>> .
>>>> /
>>>> 0
>>>> 1
>>>> 2
>>>> 3
>>>> 4
>>>> 5
>>>> 6
>>>> 7
>>>> 8
>>>> 9
>>>> => "!".."~"
>>>>
>>>> This is wrong!
>>>>
>>>> ("!".."~").last
>>>> => "~"
>>>>
>>>> This is also right.
>>>>
>>>> It looks to me like a problem with the Enumerable mixin but I guess the
>>>> question is why?
>>>>
>>>
>>> Note this
>>>
>>> irb(main):003:0> "9".succ
>>> => "10"
>>>
>>> Try this instead:
>>>
>>> (?!..?~).each {|c| p c.chr}
>>>
>>> irb(main):008:0> (?!..?~).include? ?\
>>> => false
>>>
>>> Thanks Robert,
>>
>> That is interesting. I wonder why it doesn't work as you would expect.
>> The
>> range object seems to be correct (at least through limited include?
>> testing)
>> however it returns incomplete info whenever you use an Enumerable method
>> or
>> a method that appears to use an Enumerable method.
>>
>
> In 1.9 you get this:
>
> ('!'..'~').to_a
>>>
>> => ["!", "\"", "#", "$", "%", "&", "'", "(", ")", "*", "+", ",", "-",
> ".", "/", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ":", ";",
> "<", "=", ">", "?", "@", "A", "B", "C", "D", "E", "F", "G", "H", "I",
> "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W",
> "X", "Y", "Z", "[", "\\", "]", "^", "_", "`", "a", "b", "c", "d", "e",
> "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s",
> "t", "u", "v", "w", "x", "y", "z", "{", "|", "}", "~"]
>
>
> David
>
> --
> Rails training from David A. Black and Ruby Power and Light:
> Intro to Ruby on Rails July 21-24 Edison, NJ
> Advancing With Rails August 18-21 Edison, NJ
> See http://www.rubypal.com for details and updates!
>
>
Thanks David,

That is good to know. Maybe I should upgrade.

--
"Hey brother Christian with your high and mighty errand, Your actions speak
so loud, I can't hear a word you're saying."

-Greg Graffin (Bad Religion)