0

Is it possible for TideSDK to handle something similar to:

<script type="text/javascript">
  function foo(answer) {
    $('#the_answer').text(answer)
  }
</script>
<script type="text/ruby">
  class Bar 
    def bar()
     [ .... do some lengthly analysis .... ]
     @the_found_answer = 42
     foo(@the_found_answer)
    end
  window.bar = Bar.new()

, so that processing is done by Ruby scripts and libraries, but presentation is handled by Javascript scripts?

Update: I think I found what was wrong in my code, which was the lack of scope for function invocation. Instead of:

foo(@the_found_answer)

I needed to do something like:

the_window = Ti.UI.getMainWindow()
the_domwindow = the_window.getDOMWindow()
the_domwindow.foo(@the_found_answer)

, am I right? (I didn't find any other way of getting hold of the DOM window.)

tnarik
  • 149
  • 1
  • 11

1 Answers1

0

tnarik - should be doable. have you had a look here: http://tidesdk.multipart.net/docs/user-dev/generated/#!/guide/using_ruby

meeech
  • 1,396
  • 13
  • 21
  • I was using that documentation as reference (plus some old Titanium Developer docs), but didn't see any mention to variables. But it helped me to realize the scope was missing. I'm not sure if that's the best approach though (the code from my update, I mean). – tnarik Nov 30 '12 at 15:11