Class: BaseLogic
- Inherits:
-
Object
- Object
- BaseLogic
- Defined in:
- lib/cureutils/logic/base_logic.rb
Overview
Base class of logic class
Direct Known Subclasses
DateLogic, EchoLogic, GrepLogic, JankenLogic, TranslateLogic
Instance Method Summary collapse
-
#initialize ⇒ BaseLogic
constructor
A new instance of BaseLogic.
- #source_err(source = $stderr) ⇒ Object
- #source_input(source = $stdin) ⇒ Object
- #source_output(source = $stdout) ⇒ Object
Constructor Details
#initialize ⇒ BaseLogic
Returns a new instance of BaseLogic.
7 8 9 10 11 |
# File 'lib/cureutils/logic/base_logic.rb', line 7 def initialize @in = $stdin @out = $stdout @err = $stderr end |
Instance Method Details
#source_err(source = $stderr) ⇒ Object
27 28 29 |
# File 'lib/cureutils/logic/base_logic.rb', line 27 def source_err(source = $stderr) @err = source end |
#source_input(source = $stdin) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/cureutils/logic/base_logic.rb', line 17 def source_input(source = $stdin) @in = source if source.nil? || source =~ /^-$/ # If the file name is "-", use STDIN. @in = $stdin else file(source) end end |
#source_output(source = $stdout) ⇒ Object
13 14 15 |
# File 'lib/cureutils/logic/base_logic.rb', line 13 def source_output(source = $stdout) @out = source end |