2010/2/12 John Ydil <john.gendrot / cnsi.fr>:
> Robert Klemme wrote:
>> 2010/2/11 John Ydil <john.gendrot / cnsi.fr>:
>>>>> "foreach" since you should do "foreach" on ... er ... each line in the
>>>>    puts name.strip!
>>>    from ./test.rb:5
>>>
>>>
>>> Maybe I haven't the full ruby because it's a small linux...
>>
>> Oooops! Sorry for the wrong advice. Either that or Enumerator did
>> not exist in 1.8.2 (which is ancient btw - I cannot remember having
>> used it).
>>
>> Kind regards
>>
>> robert
>
> So there is no way i can do that in 1.8.2 ?

You can write Enumerator yourself.  It isn't too hard

Enum = Struct.new :inst, :args do
  include Enumerable

  def each(&b)
    inst.send(*args, &b)
    self
  end
end

class Object
  def to_enum(*a)
    Enum.new(self, a)
  end
end

:-)

Kind regards

robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/