nyancat 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/nyancat.rb +22 -18
  2. metadata +5 -5
@@ -832,17 +832,17 @@ class NyanCat
832
832
  ',' => "\033[48;5;17m",
833
833
  '.' => "\033[48;5;15m",
834
834
  '\'' => "\033[48;5;0m",
835
- '@' => "\033[48;5;230m",
836
- '$' => "\033[48;5;175m",
837
- '-' => "\033[48;5;162m",
838
- '>' => "\033[48;5;9m",
839
- '&' => "\033[48;5;202m",
840
- '+' => "\033[48;5;11m",
841
- '#' => "\033[48;5;10m",
842
- '=' => "\033[48;5;33m",
843
- ';' => "\033[48;5;19m",
844
- '*' => "\033[48;5;8m",
845
- '%' => "\033[48;5;175m",
835
+ '@' => "\033[48;5;223m",
836
+ '$' => "\033[48;5;219m",
837
+ '-' => "\033[48;5;205m",
838
+ '>' => "\033[48;5;196m",
839
+ '&' => "\033[48;5;214m",
840
+ '+' => "\033[48;5;226m",
841
+ '#' => "\033[48;5;82m",
842
+ '=' => "\033[48;5;39m",
843
+ ';' => "\033[48;5;99m",
844
+ '*' => "\033[48;5;245m",
845
+ '%' => "\033[48;5;217m",
846
846
  }
847
847
 
848
848
  # Set output character
@@ -865,15 +865,19 @@ class NyanCat
865
865
  min_col = (max_col - term_width) / 2 if max_col > term_width
866
866
  max_col = min_col + term_width if max_col > term_width
867
867
 
868
+ frames = frames.map do |frame|
869
+ frame[min_row...max_row].map do |line|
870
+ line.chars.to_a[min_col...max_col].map do |c|
871
+ "%s%s" % [colours[c], output]
872
+ end.join + "\033[m\n"
873
+ end.join + "\033[H"
874
+ end
875
+
868
876
  printf("\033[H\033[2J\033[?25l")
869
877
  begin
870
- while (true) do
871
- frames.each do |frame|
872
- frame[min_row..max_row-1].each do |line|
873
- line[min_col..max_col-1].each_char { |c| printf("%s%s", colours[c], output) }
874
- printf("\033[m\n")
875
- end
876
- printf("\033[H")
878
+ loop do
879
+ frames.each do |frame|
880
+ print frame
877
881
  sleep(0.09)
878
882
  end
879
883
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nyancat
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ben Arblaster
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-12-02 00:00:00 +00:00
18
+ date: 2011-12-05 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -63,6 +63,6 @@ rubyforge_project:
63
63
  rubygems_version: 1.3.7
64
64
  signing_key:
65
65
  specification_version: 3
66
- summary: nyancat CLI
66
+ summary: nyancat on your terminal
67
67
  test_files: []
68
68