Class: Jsearch::Printer

Inherits:
Object
  • Object
show all
Defined in:
lib/jsearch/printer.rb

Overview

Console printer

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(silent) ⇒ Printer

Returns a new instance of Printer.



12
13
14
# File 'lib/jsearch/printer.rb', line 12

def initialize(silent)
  @silent = silent
end

Instance Attribute Details

#silentObject

Returns the value of attribute silent.



10
11
12
# File 'lib/jsearch/printer.rb', line 10

def silent
  @silent
end

Instance Method Details

#error(str) ⇒ Object



22
23
24
# File 'lib/jsearch/printer.rb', line 22

def error(str)
  $stderr.print str.red
end

#force(str) ⇒ Object



26
27
28
# File 'lib/jsearch/printer.rb', line 26

def force(str)
  $stderr.print str
end


16
17
18
19
20
# File 'lib/jsearch/printer.rb', line 16

def print(str)
  return if @silent

  $stdout.print str
end