Class: Jsearch::Printer
- Inherits:
-
Object
- Object
- Jsearch::Printer
- Defined in:
- lib/jsearch/printer.rb
Overview
Console printer
Instance Attribute Summary collapse
-
#silent ⇒ Object
Returns the value of attribute silent.
Instance Method Summary collapse
- #error(str) ⇒ Object
- #force(str) ⇒ Object
-
#initialize(silent) ⇒ Printer
constructor
A new instance of Printer.
- #print(str) ⇒ Object
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
#silent ⇒ Object
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 |
#print(str) ⇒ Object
16 17 18 19 20 |
# File 'lib/jsearch/printer.rb', line 16 def print(str) return if @silent $stdout.print str end |