This might seem weird, I just started Ruby, so don't know much about it, HOW CAN I PASS ARGUMENTS AS A STRING FROM A UNIX TERMINAL INTO A RUBY SCRIPT?
I'm developing an application with REALbasic(why?!, because I already own a license and with REALbasic I can develop and application that can run natively on OS X without the need of installing extra libraries(wxCode, wxRuby, etc(problems with building and deploying, of course I would have to include the script file, but that's simpler no?)) and using just the Ruby language installed by default on OS X), I would like to use also RUBY to process ALL the text that comes from Editfields in REAL.
I already did this "hello world" test and it's working, at least one way. In this sample you have a window, an editfield and a pushbutton, once the pushbutton is pressed, it executes a rubyscript and return its result to be displayed on the editfield. The REAL code is:
Dim s as New Shell
Dim cmd as String
#if TargetMacOS or TargetLinux and Not( TargetMacOSClassic)
cmd="cd /Applications/hello-ruby ; ruby hello.rb"
if s.errorCode=0 then
EditField1.text="Error "+ Str(s.ErrorCode)
If you are not familiar with REAL, in this sample I'm using a SHELL class that can be used to execute Unix or DOS shell commands under Windows, Mac OS X, or Linux, so in the OS X terminal runs [cd /Applications/hello-ruby ; ruby hello.rb] and inside the ruby script there is a simple
puts "Hello World!"
which is returned to the editfield in the REAL interface and displayed. NOW! I would like to make another sample that could work in the other way also, so let's suppose I have 3 editfields and a pushbutton, in editfield1 I enter "hello", next in editfield2 "world!", once the button is pressed the editfield3 displays the result "hello world!" which was concatenated in a ruby script.
From the Shell class of REAL I would have to send the strings into the terminal using ECHO, then How I pass them into the ruby script from the terminal to be processed?