Class: BaseLogic

Inherits:
Object
  • Object
show all
Defined in:
lib/cureutils/logic/base_logic.rb

Overview

Base class of logic class

Instance Method Summary collapse

Constructor Details

#initializeBaseLogic

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