smooth_terminal_print 2.0.0 → 2.1.0

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/smooth_terminal_print.rb +11 -2
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b80d17f78b7a5d8b3c88c56f7ce920f7aaae010b
4
- data.tar.gz: 1b1a453db1651bb68594fba40a45e65829142fae
3
+ metadata.gz: 7834a40c9f642f5aa6845c9abb1dadb57e157769
4
+ data.tar.gz: 1958febfbff85b9a6652a2db96c06993fa77fa91
5
5
  SHA512:
6
- metadata.gz: b6b674ed934757c321146237f12a2b7f421da0c0e2d04513e3532949bbec6c69c3636099ce977463dedae670fb5caa6fb88b12df25d6c2f58280c8806bbfdc29
7
- data.tar.gz: 926ff92b54af16c2fa4b7ce1fbdc7c181923bfe9eee3a4ff55378be5d9c76346e708f7a2f3a513cf046a097c6b43458a7557e7b0b7fe7112b7070db9c19dd705
6
+ metadata.gz: 557801c8090aa1580e4f8efb33c5013fc8d904a3672062fe6e801a6054396df32a19fba3904113afeca61ee71bb451a544baaa8e09378fae9751da4972a48f00
7
+ data.tar.gz: 9cfea9d5de40cc0fc2b6709811b8e82b1b70d5b2d6620cd32a76b067009d53255e51aaa26ebdeca7550f0f73228e3370c2389ad40f5870956b1c51672ffa295b
@@ -12,11 +12,20 @@ class SmoothTerminalPrint
12
12
  at_exit { stop_smooth_printing_mode }
13
13
  end
14
14
 
15
- def print_smoothly(io)
15
+ def print_smoothly(io=nil, &block)
16
16
  print(hide_cursor)
17
17
  print(move_to_top_left)
18
18
 
19
- print_text(io)
19
+ if(io)
20
+ print_text(io)
21
+ else
22
+ io = StringIO.new
23
+ $stdout = io
24
+ yield
25
+ $stdout = STDOUT
26
+ io.rewind
27
+ print_text(io)
28
+ end
20
29
  end
21
30
 
22
31
  def stop_smooth_printing_mode
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smooth_terminal_print
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Sykes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-08 00:00:00.000000000 Z
11
+ date: 2016-12-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Animate printing text in a terminal window while in a tight loop
14
14
  email: brettcsykes@gmail.com