Getting hostname from ruby


#1

Is there a cleaner way to get the host name from ruby other than
hostname?

phil


#2

phil swenson wrote:

Is there a cleaner way to get the host name from ruby other than
hostname?

require ‘socket’

hostname = Socket.gethostname


#3

I am trying to insert my own data into an FXImage and the setData
member look just what I need. Unfortunately, regardless of the
number of parameters I pass it I always get the

test.rb:10:in `setData’: No matching function for overloaded
‘FXImage_setData’ (ArgumentError)
from test.rb:10

I have looked at the swig files but am none the wiser as to what I am
doing wrong, or if there is a bug here.

The simple test case is below and while this doesn’t achieve anything
it does demonstrate the point.

I am using FX 1.4.3 running on Mac OSX 10.4 with ruby 1.8.3
(2005-09-21) [powerpc-darwin8.3.0]

#!/usr/bin/env ruby

require ‘fox14’
include Fox

application = FXApp.new(“Hello”, “FoxTest”)
main = FXMainWindow.new(application, “Hello”, nil, nil, DECOR_ALL)
@buffer = FXImage.new(application, nil, IMAGE_KEEP, 640, 480)
data = [0xff00ff00] * 640 * 480
@buffer.setData(data, 0)

application.create()
main.show(PLACEMENT_SCREEN)
application.run()

Thanks,

Dave.


#4

phil swenson wrote:

Is there a cleaner way to get the host name from ruby other than
hostname?

16:21:55 [~]: ruby -r socket -e ‘p Socket.gethostname’
“bond”

Kind regards

robert