roflcopter 0.0.3 → 0.0.4

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.
data.tar.gz.sig CHANGED
Binary file
@@ -2,4 +2,4 @@
2
2
 
3
3
  require 'roflcopter'
4
4
 
5
- Roflcopter.new.fly
5
+ Roflcopter.fly
@@ -1,69 +1,65 @@
1
1
  require 'roflcopter/version'
2
2
  require 'curses'
3
3
 
4
- class Roflcopter
5
- include Curses
6
-
7
- def initialize
8
- curs_set @frame = 0
9
- @altitude = 5
10
- @chopper = [
11
- %| |,
12
- %| 4321043210LOL4321043210 |,
13
- %| ^ |,
14
- %|012 /------------- |,
15
- %|3O3======= [ ] \\ |,
16
- %|210 \\ \\ |,
17
- %| \\____________] |,
18
- %| I I |,
19
- %| --------------/ |,
20
- %| |
21
- ]
22
- end
23
-
24
- def fly
25
- audio
26
- video
27
- end
28
-
29
- def audio
30
- Thread.new do
31
- system "say -v Alex the rofl copter says #{'siff ' * 1000}"
32
- exit
4
+ module Roflcopter
5
+ class << self
6
+ include Curses
7
+
8
+ def fly
9
+ audio
10
+ video
11
+ end
12
+
13
+ def audio
14
+ Thread.new do
15
+ system "say -v Alex the rofl copter says #{'siff ' * 1000}"
16
+ exit
17
+ end
33
18
  end
34
- end
35
-
36
- def video
37
- init_screen
38
19
 
39
- while @frame += 1
40
- @chopper.each_with_index do |line, index|
41
- { 1 => [':LFOR', 5], (3..5) => ['L ', 4] }.each do |key, (ch, n)|
42
- if key === index
20
+ def video
21
+ init_screen
22
+ curs_set frame = 0
23
+ altitude = 5
24
+
25
+ while frame += 1
26
+ [
27
+ %| |,
28
+ %| 4321043210LOL4321043210 |,
29
+ %| ^ |,
30
+ %|012 /------------- |,
31
+ %|3O3======= [ ] \\ |,
32
+ %|210 \\ \\ |,
33
+ %| \\____________] |,
34
+ %| I I |,
35
+ %| --------------/ |,
36
+ %| |
37
+ ].each_with_index do |line, index|
38
+ { 1 => [':LFOR', 5], (3..5) => ['L ', 4] }.each do |key, (ch, n)|
43
39
  n.times do |i|
44
- line.tr!(i.to_s, ch.chars.to_a[(i + @frame) % n])
45
- end
40
+ line.tr!(i.to_s, ch.chars.to_a[(i + frame) % n])
41
+ end if key === index
42
+
43
+ copter = (line + (' ' * (cols - 31))).chars.to_a
44
+ frame.times { copter.unshift copter.pop }
45
+
46
+ setpos altitude + index, 0
47
+ addstr copter.join
46
48
  end
47
49
 
48
- copter = (line + (' ' * (cols - 31))).chars.to_a
49
- @frame.times { copter.unshift copter.pop }
50
+ case rand 1..10
51
+ when 1
52
+ altitude -= 1
53
+ when 10
54
+ altitude += 1
55
+ end
50
56
 
51
- setpos @altitude + index, 0
52
- addstr copter.join
57
+ refresh
58
+ sleep 0.08
53
59
  end
54
60
 
55
- case rand 1..10
56
- when 1
57
- @altitude -= 1
58
- when 10
59
- @altitude += 1
60
- end
61
-
62
- refresh
63
- sleep 0.08
61
+ at_exit { close_screen }
64
62
  end
65
-
66
- at_exit { close_screen }
67
63
  end
68
64
  end
69
65
  end
@@ -1,3 +1,3 @@
1
- class Roflcopter
2
- VERSION = '0.0.3'
1
+ module Roflcopter
2
+ VERSION = '0.0.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roflcopter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
metadata.gz.sig CHANGED
Binary file