Mark Hubbart <discord / mac.com> wrote: > nested method? That doesn't sound familiar. Could you post the actual > error printout that you get? That should help tack it down. the error : <script>: [42, 0] nested method definition Expecting: but found instead <script>: [51, 0] syntax error Expecting: kEND but found end-of-file instead org.jruby.parser.DefaultRubyParser$yyException: irrecoverable syntax error at end-of-file [...] > > obviously i've tried something like : > > [...] > > > > what is the ruby way for such nested methods ? > > Honestly, this code looks fine to me, assuming you definded > "doOperand()" and "doValue()" elsewhere in the script. Could you post a > little more code? :) the code (remember i'm using JRuby, not Ruby) : require 'java' module Swing include_package "javax.swing" end module JavaLang include_package 'java.lang' end me = $bsf.lookupBean ("me") tag = $bsf.lookupBean ("tag") textfield = me.getComponent("text-field") storage = me.getTagComponent("text-field") type = tag.getProperty("js-type") value = tag.getProperty("js-value") action = tag.getProperty("action") textfield.setText("From JRuby") print "type : ", type, "\n" print "value : ", value, "\n" print "action : ", action, "\n" print "action.length : ", action.length, "\n" text = textfield.getText() def clearField() textfield.setText("") end def doOperand(t, v) if value == "ce" clearField() else if value == "backspace" print "backspace()", "\n" else if value == "on" clearField() # setMemory("0") # setOperand("") # setProperty("action", value) end end def doIt(t, v) if t == "operand" doOperand(t, v) else print "doValue()", "\n" # doValue(t, v) end end doIt(type, value) -- yt