[Kde-bindings] String is no longer Enumerable on Ruby 1.9.1

Richard Dale rdale at foton.es
Thu Mar 19 10:54:51 UTC 2009


On Wednesday 18 March 2009 22:23:59 airh2002 at oak.dti.ne.jp wrote:
> String is no longer Enumerable on Ruby 1.9.1, and String#each is
> nonexistent.
>
> For QtRuby, I find String#each usage on rbqtapi.
> I suppose below:
>
> 145c145
> < candidates.each do |candidate|
> ---
>
> > candidates.send(RUBY_VERSION >= '1.9.0'? :each_line : :each) do
> >
> |candidate|
>
> This is useful for before 1.8.x and after 1.9.x.
Ah ok well spotted, I need to keep testing qtruby with 1.9.1 but having two 
Rubys installed was difficult to manage. Do we need to do a version test, or 
will split and puts  work with both like this?

candidates.split("\n").each do |candidate|
  if candidate =~ /~/ || candidate =~ /qt_metacall/ || candidate =~ 
/staticMetaObject/
    next
  end

  puts candidate.to_ruby_method(showOpt) if pattern.nil? || pattern =~ 
candidate
end

-- Richard



More information about the Kde-bindings mailing list