nyan-cat 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/bin/nyan-cat +2 -0
- data/lib/nyan-cat/cat.rb +3 -3
- data/lib/nyan-cat/ui.rb +5 -4
- data/lib/nyan-cat/version.rb +1 -1
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54a3811c5e871c270b72c8fc3f4fac7d59b36fe0
|
4
|
+
data.tar.gz: edc8543656d989ac67dd44d01c5048bb37083297
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 465cf6d86fee8345a96ac5001fe33e9feba4d17941be2bd58ee200a00582fad2a76ccad448789d128cab7b814516c6502b9b870b1807a0ea38438f4605d58928
|
7
|
+
data.tar.gz: 0dba73a40a75c9fb328aee01be1136de8522a6949b10881703d349fb9bf69a1c7ef381e20ea2fa45f5b606e44724541df76de412011223bab3378efccdec3aa5
|
data/Gemfile.lock
CHANGED
data/bin/nyan-cat
CHANGED
data/lib/nyan-cat/cat.rb
CHANGED
@@ -23,8 +23,7 @@ END
|
|
23
23
|
@frame_count = 0
|
24
24
|
end
|
25
25
|
|
26
|
-
def tick(frame_count =
|
27
|
-
frame_count ||= @frame_count
|
26
|
+
def tick(frame_count = @frame_count)
|
28
27
|
increment_internal_frame_count
|
29
28
|
generate_cat(frame_count)
|
30
29
|
end
|
@@ -45,8 +44,8 @@ END
|
|
45
44
|
lines = frame.split(/\r?\n/)
|
46
45
|
frame_with_trails = lines.map.with_index do |line, i|
|
47
46
|
@trail_length.times do |j|
|
48
|
-
color_index = j - @frame_count % @trail_length
|
49
47
|
if @colorize_trail
|
48
|
+
color_index = j - @frame_count % @trail_length
|
50
49
|
line.prepend(Paint[trail_char(index, i, j), rainbow(color_index)])
|
51
50
|
else
|
52
51
|
line.prepend(trail_char(index, i, j))
|
@@ -54,6 +53,7 @@ END
|
|
54
53
|
end
|
55
54
|
line
|
56
55
|
end
|
56
|
+
|
57
57
|
frame_with_trails.join("\n")
|
58
58
|
end
|
59
59
|
|
data/lib/nyan-cat/ui.rb
CHANGED
@@ -13,17 +13,18 @@ module NyanCat
|
|
13
13
|
private
|
14
14
|
|
15
15
|
def render_frame(frame)
|
16
|
-
|
17
|
-
puts frame
|
16
|
+
printf frame
|
18
17
|
delay_next_render
|
18
|
+
clear_screen(frame)
|
19
19
|
end
|
20
20
|
|
21
21
|
def delay_next_render
|
22
22
|
sleep (1.0/8.0)
|
23
23
|
end
|
24
24
|
|
25
|
-
def clear_screen
|
26
|
-
|
25
|
+
def clear_screen(frame)
|
26
|
+
length = (frame.split("\n").length - 1)
|
27
|
+
printf "\e[1A" * length + "\r"
|
27
28
|
end
|
28
29
|
end
|
29
30
|
end
|
data/lib/nyan-cat/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nyan-cat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Keathley
|
@@ -14,28 +14,28 @@ dependencies:
|
|
14
14
|
name: paint
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 0.8.6
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.8.6
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
description: Nyan Cat all of the things
|
@@ -45,8 +45,8 @@ executables:
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
-
- .gitignore
|
49
|
-
- .travis.yml
|
48
|
+
- ".gitignore"
|
49
|
+
- ".travis.yml"
|
50
50
|
- Gemfile
|
51
51
|
- Gemfile.lock
|
52
52
|
- LICENSE
|
@@ -69,17 +69,17 @@ require_paths:
|
|
69
69
|
- lib
|
70
70
|
required_ruby_version: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
|
-
- -
|
72
|
+
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0'
|
75
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
76
|
requirements:
|
77
|
-
- -
|
77
|
+
- - ">="
|
78
78
|
- !ruby/object:Gem::Version
|
79
79
|
version: '0'
|
80
80
|
requirements: []
|
81
81
|
rubyforge_project:
|
82
|
-
rubygems_version: 2.
|
82
|
+
rubygems_version: 2.2.0
|
83
83
|
signing_key:
|
84
84
|
specification_version: 4
|
85
85
|
summary: Command line cat
|