Class: AsciiParadise::Lobster
- Inherits:
-
Base
- Object
- Base
- AsciiParadise::Lobster
show all
- Defined in:
- lib/ascii_paradise/misc/lobster.rb
Overview
Constant Summary
collapse
- LOBSTER_RIGHT =
Zlib::Inflate.inflate("eJx9kEEOwyAMBO99xd7MAcytUhPlJyj2
P6jy9i4k9EQyGAnBarEXeCBqSkntNXsi/ZCvC48zGQoZKikGrFMZvgS5ZHd+aGWVuWwhVF0
t1drVmiR42HcWNz5w3QanT+2gIvTVCiE1lm1Y0eU4JGmIIbaKwextKn8rvW+p5PIwFl8ZWJ
I8jyiTlhTcYXkekJAzTyYN6E08A+dk8voBkAVTJQ==".delete("\n ").unpack('m*')[0])
- LOBSTER_LEFT =
LOBSTER_RIGHT.split("\n").
map { |line| line.ljust(42).reverse }.join("\n")
Class Method Summary
collapse
-
.[](i = '') ⇒ Object
# === AsciiParadise::Lobster[] ========================================================================= #.
Instance Method Summary
collapse
Methods inherited from Base
animation_dir?, #animation_directory?, #clear_screen, #colour_parse_this_string, #debug?, #do_not_run_already, #do_not_use_clear, #do_use_random_colour, #do_wait_for_keypress_event, e, #e, #enable_debug, #is_animated?, #menu, #project_base_dir?, #register_sigint, #remove_trailing_ansci_escape_code, #report_how_many_animated_components_exist, #return_basename_of_this_file_without_the_extension, #return_random_colour, #rev, #royalblue, run, #set_use_this_colour, #sfancy, #sfile, #show_available_components, #show_help, #simp, #slategrey, #sort_files, #static_dir?, #steelblue, #swarn, #use_colours?
Constructor Details
#initialize(i = nil, run_already = true) ⇒ Lobster
38
39
40
41
42
43
44
45
46
|
# File 'lib/ascii_paradise/misc/lobster.rb', line 38
def initialize(
i = nil,
run_already = true
)
reset
register_sigint
set_input(i)
run if run_already
end
|
Class Method Details
.[](i = '') ⇒ Object
#
AsciiParadise::Lobster[]
#
98
99
100
|
# File 'lib/ascii_paradise/misc/lobster.rb', line 98
def self.[](i = '')
new(i)
end
|
Instance Method Details
68
69
70
|
# File 'lib/ascii_paradise/misc/lobster.rb', line 68
def input?
@input
end
|
#reset ⇒ Object
51
52
53
54
|
# File 'lib/ascii_paradise/misc/lobster.rb', line 51
def reset
super()
@delay = 0.75
end
|
#run ⇒ Object
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
# File 'lib/ascii_paradise/misc/lobster.rb', line 75
def run
run_n_times = 50
current_run = 1
toggle_status = :right
loop {
::AsciiParadise.clear_screen
case toggle_status
when :right
e LOBSTER_RIGHT
toggle_status = :left
when :left
e LOBSTER_LEFT
toggle_status = :right
end
sleep @delay
current_run += 1
break if current_run > run_n_times
}
end
|
59
60
61
62
63
|
# File 'lib/ascii_paradise/misc/lobster.rb', line 59
def set_input(i = '')
i = i.first if i.is_a? Array
i = i.to_s.dup
@input = i
end
|