rubytext 0.0.98 → 0.0.99

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db229c48ceef85f09ba0f26e8a2b9db9c38254f5285c511dbd208c37061a0db6
4
- data.tar.gz: df30b42eced953fba5747e56c71e5a8fb682a37eb802d7318731c0b9619801a8
3
+ metadata.gz: ed249d5b71890e0168e5beeec3df234828e960adaa39a8a4c20fb3ebb7227650
4
+ data.tar.gz: '0439b13c9ad99efbd13b3031c670230df7d8a69c272a02d12e072909e22e5e9f'
5
5
  SHA512:
6
- metadata.gz: 289af3313189482069f4077f5fd8206d065acc20f5e870c1312eaf5c9510ab7738d6f152e8bff7e17b2588220a1b4b0ed4393cc3f689fd3bea940b595206bf47
7
- data.tar.gz: 3786a4654e1a4bd580079dc77cae3b58e647a61346e607ba40bb8c55294a515c0183845b9fd909b474ac2231324cdf5c793c3b51c5cba2d090387729a8808ef8
6
+ metadata.gz: cb0d4242a294b093fe772030d62eb3fe732f7f5919dacaf564f66ca18d4daebd415778eba755dd6323606ab185379f95545688b4b375a3e8715b9eae5945b942
7
+ data.tar.gz: 1a66bee008240ef31d5a30db9ded52fe6bb3461f4f58ed955b7b62861e9129ea606f0fd3b28bea8f561ca88a4371f75bdf297b35538febb64456ccb34142a731
data/examples/slides CHANGED
@@ -12,29 +12,29 @@ Dir.chdir(examples)
12
12
  rc = system("ruby check.rb")
13
13
  exit unless rc
14
14
 
15
-
16
- showme("simple_win")
17
- showme("stdscr")
18
- showme("stdout_etc")
19
- showme("detect_rc")
20
- showme("brackets")
21
- showme("brack_equal")
22
- showme("puts_print")
23
- showme("output_meth")
24
- showme("win_centering")
25
- showme("putch")
26
- showme("sym_navigate")
27
- showme("effects")
28
- showme("center_meth")
29
- showme("topbottom")
30
- showme("udlr_bang")
31
- showme("updown_etc")
32
- showme("home_udlr")
33
- showme("rcprint")
34
- showme("go_meth")
35
- showme("no_border")
36
- showme("no_scroll")
37
- showme("window_full")
38
- showme("ticker_threads", 11)
39
- showme("simple_menu")
15
+ showme("simple_win")
16
+ showme("stdscr")
17
+ showme("stdout_etc")
18
+ showme("detect_rc")
19
+ showme("brackets")
20
+ showme("brack_equal")
21
+ showme("puts_print")
22
+ showme("output_meth")
23
+ showme("win_centering")
24
+ showme("putch")
25
+ showme("sym_navigate")
26
+ showme("effects")
27
+ showme("center_meth")
28
+ showme("home_udlr")
29
+ showme("udlr_bang")
30
+ showme("updown_etc")
31
+ showme("topbottom")
32
+ showme("rcprint")
33
+ showme("go_meth")
34
+ showme("no_border")
35
+ showme("no_scroll")
36
+ showme("window_full")
37
+ showme("spin")
38
+ showme("ticker_threads", 11)
39
+ showme("simple_menu")
40
40
 
data/examples/spin.rb ADDED
@@ -0,0 +1,9 @@
1
+ puts 'Suppose you want to display an old-fashioned "spinner"'
2
+ puts "while some long-running process finishes.\n "
3
+
4
+ puts "The spinner class method will do this (and count elapsed seconds)\n "
5
+
6
+ RubyText.spinner { 10000.times { 20000.times { 99*88 } } }
7
+
8
+ puts "\n...finished."
9
+
data/lib/output.rb CHANGED
@@ -139,7 +139,7 @@ class RubyText::Window
139
139
  end
140
140
 
141
141
  class GetString
142
- def initialize(win = STDSCR, str = "", i = 0, history: nil)
142
+ def initialize(win = STDSCR, str = "", i = 0, history: [])
143
143
  @win = win
144
144
  @r0, @c0 = @win.rc
145
145
  @str, @i = str, i
@@ -216,7 +216,7 @@ class RubyText::Window
216
216
  end
217
217
  end
218
218
 
219
- def gets(history: nil) # still needs improvement
219
+ def gets(history: []) # still needs improvement
220
220
  # echo assumed to be OFF, keypad ON
221
221
  @history = history
222
222
  gs = GetString.new(self, history: history)
data/lib/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  module RubyText
3
- VERSION = "0.0.98"
3
+ VERSION = "0.0.99"
4
4
 
5
5
  Path = File.expand_path(File.join(File.dirname(__FILE__)))
6
6
  end
data/lib/widgets.rb CHANGED
@@ -16,7 +16,18 @@ module RubyText
16
16
  def self.spinner(win: STDSCR, &block) # TODO delay, etc.
17
17
  chars = "-\\|/"
18
18
  RubyText.hide_cursor
19
- thread = Thread.new { i=0; loop { i = (i+1) % 4; win.print chars[i]; win.left; sleep 0.1 } }
19
+ t0 = Time.now.to_i
20
+ thread = Thread.new do
21
+ i=0
22
+ loop do
23
+ t1 = Time.now.to_i
24
+ elapsed = "0:%02d" % (t1-t0)
25
+ i = (i+1) % 4
26
+ win.print " " + chars[i] + " " + elapsed
27
+ win.left!
28
+ sleep 0.04
29
+ end
30
+ end
20
31
  block.call
21
32
  win.puts
22
33
  Thread.kill(thread)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubytext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.98
4
+ version: 0.0.99
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-22 00:00:00.000000000 Z
11
+ date: 2018-12-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curses
@@ -65,6 +65,7 @@ files:
65
65
  - examples/simple_menu.rb
66
66
  - examples/simple_win.rb
67
67
  - examples/slides
68
+ - examples/spin.rb
68
69
  - examples/stdout_etc.rb
69
70
  - examples/stdscr.rb
70
71
  - examples/sym_navigate.rb