[Ironruby-core] mscorlib:0:in `ThrowArgumentException' error

Eduardo Blumenfeld lists at ruby-forum.com
Mon Aug 9 21:16:05 EDT 2010


Hi all,

I'm having an error that I can't figure out what it is:

This portion of code works perfectly by itself
--------------------
config = [{:QuantityPer => "\#{2+2}"}]
config.each { |xx| if xx[:QuantityPer].include? '#{' then
  xxx = xx[:QuantityPer].to_s
  xxx = xxx[2..(xxx.size-2)]
  puts xxx
  xx[:QuantityPer] = eval(xxx)
  puts xx[:QuantityPer]
  end
  }
-------------------
prints
2+2
4
as supposed
------------

However in the middle of a routine throws this error:
-----------------------
2+2
mscorlib:0:in `ThrowArgumentException': An item with the same key has
already been added. (ArgumentError)
        from mscorlib:0:in `Insert'
        from ./xxx_master.rb:641:in `eval'
-----------------------
the line 641 actually is the one corresponding to the beginning of the
"config.each" statement and not the one for the eval...

Could someone point me in the right direction?

Thank you in advance

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


More information about the Ironruby-core mailing list