Class: CureEchoManager
- Inherits:
-
Object
- Object
- CureEchoManager
- Defined in:
- lib/cureutils/cure_echo_manager.rb
Overview
Singleton class for cure echo
Defined Under Namespace
Modules: EchoMode
Instance Method Summary collapse
-
#initialize ⇒ CureEchoManager
constructor
A new instance of CureEchoManager.
- #msg_attack(flag = false) ⇒ Object
- #msg_transform(flag = true) ⇒ Object
- #nosleep(flag = true) ⇒ Object
- #precure(cure_name = false) ⇒ Object
- #print_results ⇒ Object
- #source_err(source = $stderr) ⇒ Object
- #source_input(source = $stdin) ⇒ Object
- #source_output(source = $stdout) ⇒ Object
Constructor Details
#initialize ⇒ CureEchoManager
10 11 12 13 14 15 16 |
# File 'lib/cureutils/cure_echo_manager.rb', line 10 def initialize @in = $stdin @out = $stdout @err = $stderr @cure_name = 'echo' = EchoMode::TRANSFORM end |
Instance Method Details
#msg_attack(flag = false) ⇒ Object
38 39 40 |
# File 'lib/cureutils/cure_echo_manager.rb', line 38 def msg_attack(flag = false) = EchoMode::ATTACK if flag end |
#msg_transform(flag = true) ⇒ Object
34 35 36 |
# File 'lib/cureutils/cure_echo_manager.rb', line 34 def msg_transform(flag = true) = EchoMode::TRANSFORM if flag end |
#nosleep(flag = true) ⇒ Object
42 43 44 45 |
# File 'lib/cureutils/cure_echo_manager.rb', line 42 def nosleep(flag = true) Rubicure::Girl.sleep_sec = 1 Rubicure::Girl.sleep_sec = 0 if flag end |
#precure(cure_name = false) ⇒ Object
30 31 32 |
# File 'lib/cureutils/cure_echo_manager.rb', line 30 def precure(cure_name = false) @cure_name = cure_name || 'echo' end |
#print_results ⇒ Object
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/cureutils/cure_echo_manager.rb', line 47 def print_results return 1 unless existing_precure? if == EchoMode::TRANSFORM Cure.send(@cure_name.to_sym).transform! elsif == EchoMode::ATTACK Cure.send(@cure_name.to_sym).transform! Cure.send(@cure_name.to_sym).attack! end 0 end |
#source_err(source = $stderr) ⇒ Object
26 27 28 |
# File 'lib/cureutils/cure_echo_manager.rb', line 26 def source_err(source = $stderr) @err = source end |
#source_input(source = $stdin) ⇒ Object
22 23 24 |
# File 'lib/cureutils/cure_echo_manager.rb', line 22 def source_input(source = $stdin) @in = source end |
#source_output(source = $stdout) ⇒ Object
18 19 20 |
# File 'lib/cureutils/cure_echo_manager.rb', line 18 def source_output(source = $stdout) @out = source end |