summaryrefslogtreecommitdiff
path: root/ruby/examples
diff options
context:
space:
mode:
Diffstat (limited to 'ruby/examples')
-rw-r--r--ruby/examples/hello-world.rb10
-rw-r--r--ruby/examples/qmf-libvirt.rb1
2 files changed, 8 insertions, 3 deletions
diff --git a/ruby/examples/hello-world.rb b/ruby/examples/hello-world.rb
index 9cddf93ae0..755d13bd54 100644
--- a/ruby/examples/hello-world.rb
+++ b/ruby/examples/hello-world.rb
@@ -18,11 +18,17 @@
# under the License.
#
-require "rubygems"
require "qpid"
require "socket"
-conn = Qpid::Connection.new(TCPSocket.new("localhost", 5672))
+broker = if ARGV.length > 0 then ARGV[0] else "localhost" end
+port = if ARGV.length > 1 then ARGV[1].to_i else 5672 end
+if ARGV.length > 2 then
+ puts "usage: hello-world.rb [ <broker> [ <port> ] ]"
+ exit 1
+end
+
+conn = Qpid::Connection.new(TCPSocket.new(broker, port))
conn.start(10)
ssn = conn.session("test")
diff --git a/ruby/examples/qmf-libvirt.rb b/ruby/examples/qmf-libvirt.rb
index 128cfb95ee..492f4fe8d6 100644
--- a/ruby/examples/qmf-libvirt.rb
+++ b/ruby/examples/qmf-libvirt.rb
@@ -18,7 +18,6 @@
# under the License.
#
-require "rubygems"
require "qpid"
s = Qpid::Qmf::Session.new()