Might be a bug.

-----Original Message-----
From: ironruby-core-boun...@rubyforge.org 
[mailto:ironruby-core-boun...@rubyforge.org] On Behalf Of Lewis L.
Sent: Wednesday, October 19, 2011 8:24 AM
To: ironruby-core@rubyforge.org
Subject: [Ironruby-core] override method_missing()

Hi,
Is there a way to override the method_missing method and keep the SetVariable 
lookup behavior from ScriptScope?
For example,

in C#
aScriptScope.SetVariable("a", "some_value")

in Ruby
p a
=> "some_value"

But if I do,

class << self
  def method_missing(sym, *args, &block)
    case (sym)
    when :some_case
       do_something
    else
       super #try to fallback to the original
    end
  end
end

or

class << self
  alias :old_method_missing :method_missing
  def method_missing(sym, *args, &block)
    case (sym)
    when :some_case
       do_something
    else
       old_method_missing(sym, *args, &block) #try to fallback to the original
    end
  end
end

p a
=> NameError: undefined local variable or method 'a' for main:Object

--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core




_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to