class Spellr::Output

Public Instance Methods

<<(other) click to toggle source
# File lib/spellr/output.rb, line 53
def <<(other)
  self.exit_code = other.exit_code
  warn other.stderr.string if other.stderr?
  puts other.stdout.string if other.stdout?
  counts.merge!(other.counts) { |_k, a, b| a + b }
end
counts() click to toggle source
# File lib/spellr/output.rb, line 29
def counts
  @counts ||= Hash.new(0)
end
exit_code() click to toggle source
# File lib/spellr/output.rb, line 5
def exit_code
  @exit_code ||= 0
end
exit_code=(value) click to toggle source
# File lib/spellr/output.rb, line 33
def exit_code=(value)
  @exit_code = value unless value.zero?
end
increment(counter) click to toggle source
# File lib/spellr/output.rb, line 37
def increment(counter)
  counts[counter] += 1
end
print(str) click to toggle source
puts(str) click to toggle source
# File lib/spellr/output.rb, line 41
def puts(str)
  stdout.puts(str)
end
stderr() click to toggle source
# File lib/spellr/output.rb, line 17
def stderr
  @stderr ||= $stderr
end
stderr?() click to toggle source
# File lib/spellr/output.rb, line 25
def stderr?
  defined?(@stderr)
end
stdin() click to toggle source
# File lib/spellr/output.rb, line 9
def stdin
  @stdin ||= $stdin
end
stdout() click to toggle source
# File lib/spellr/output.rb, line 13
def stdout
  @stdout ||= $stdout
end
stdout?() click to toggle source
# File lib/spellr/output.rb, line 21
def stdout?
  defined?(@stdout)
end
warn(str) click to toggle source
# File lib/spellr/output.rb, line 45
def warn(str)
  stderr.puts(str)
end