drawille 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bd1ab9b0b573d50317ce0b8ac4252f18594df372
4
- data.tar.gz: db6b1ecbf2f602019a91caa2815b55a5a21166ea
3
+ metadata.gz: c3a60513c65dfe590e9d25f8b6929b8fb432d27f
4
+ data.tar.gz: 96efb58c4b3f7065034eb85896b6d65112d0093d
5
5
  SHA512:
6
- metadata.gz: 68d0fc7ef536fab25396f6059ecbb25c7ceab68104939b1bb4f4ecc01af67410d95197fcb0d67d2e9d3dc8dc3aba40fd2f593f2c0c3d0a1674829dca2cac3105
7
- data.tar.gz: 678a730a7988ef16ab39a58b8184841093282170e969cef15439a5b9dedd6e8e835a68998846f610d2a2744961ec0606102ef539d52370392085db6afb6b7fff
6
+ metadata.gz: 122d8f9f4acf3098296f3750fadc27ec21531b9fa8045ec109791cf3ac4ceff91321f512ef34dee6567dbaa1680d347bd41bb70b52a534df54fd2ba844de9e9c
7
+ data.tar.gz: 5f8f46911c99626d64c1ed150714031c98fb7acf7ab000b43aed174c92e87ffc2855fd023a3d5dde7945c7b491f4b5f03961a92b130711b7259bf2eebff2b886
@@ -38,11 +38,17 @@ module Drawille
38
38
  Curses::crmode
39
39
  Curses::curs_set 0
40
40
  repeat options do
41
- each_frame options do |frame|
42
- Curses::setpos(0, 0)
43
- Curses::addstr(frame)
44
- Curses::refresh
45
- sleep(1.0/options[:fps])
41
+ if block_given?
42
+ loop {
43
+ canvas = yield
44
+ raise StopIteration if canvas == nil
45
+ draw canvas.frame
46
+ }
47
+ else
48
+ each_frame options do |frame|
49
+ draw frame
50
+ sleep(1.0/options[:fps])
51
+ end
46
52
  end
47
53
  end
48
54
  ensure
@@ -56,6 +62,12 @@ module Drawille
56
62
 
57
63
  private
58
64
 
65
+ def draw frame
66
+ Curses::setpos(0, 0)
67
+ Curses::addstr(frame)
68
+ Curses::refresh
69
+ end
70
+
59
71
  def clear_screen options
60
72
  Curses::clear
61
73
  Curses::refresh
@@ -1,3 +1,3 @@
1
1
  module Drawille
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drawille
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcin Skirzynski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-03 00:00:00.000000000 Z
11
+ date: 2014-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curses