~ubuntu-branches/ubuntu/hardy/ruby1.8/hardy-updates

« back to all changes in this revision

Viewing changes to ext/curses/hello.rb

  • Committer: Bazaar Package Importer
  • Author(s): akira yamada
  • Date: 2007-03-13 22:11:58 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20070313221158-h3oql37brlaf2go2
Tags: 1.8.6-1
* new upstream version, 1.8.6.
* libruby1.8 conflicts with libopenssl-ruby1.8 (< 1.8.6) (closes: #410018)
* changed packaging style to cdbs from dbs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/local/bin/ruby
 
2
 
 
3
require "curses"
 
4
include Curses
 
5
 
 
6
def show_message(message)
 
7
  width = message.length + 6
 
8
  win = Window.new(5, width,
 
9
                   (lines - 5) / 2, (cols - width) / 2)
 
10
  win.box(?|, ?-)
 
11
  win.setpos(2, 3)
 
12
  win.addstr(message)
 
13
  win.refresh
 
14
  win.getch
 
15
  win.close
 
16
end
 
17
 
 
18
init_screen
 
19
begin
 
20
  crmode
 
21
#  show_message("Hit any key")
 
22
  setpos((lines - 5) / 2, (cols - 10) / 2)
 
23
  addstr("Hit any key")
 
24
  refresh
 
25
  getch
 
26
  show_message("Hello, World!")
 
27
  refresh
 
28
ensure
 
29
  close_screen
 
30
end