aboutsummaryrefslogtreecommitdiff
path: root/examples/000-IVYTranslater.rb
blob: e092235effe3f370d29f80184451f5078cc0e0cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/ruby

$:.unshift( ".." )

require "ivy"

ivy = IVY.new( "IvyRbTranslator", "Hello Le Monde" )
ivy.start( )

msg = ivy.bindmsg( nil, "^Hello(.*)" ) { |app, data, tab|
  arg = (tab.size < 1)?"":tab[0]
  ivy.sendmsg( "Bonjour#{arg}" )
}

msg2 = ivy.bindmsg( nil, "^Bye$" ) { |app, data, tab|
  ivy.stop( )
}

ivy.mainloop( )