Class: Rink::OutputMethod::Base
- Defined in:
- lib/rink/output_method/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#silenced ⇒ Object
writeonly
Sets the attribute silenced.
Instance Method Summary collapse
-
#initialize(silenced = false) ⇒ Base
constructor
A new instance of Base.
- #output ⇒ Object
- #print(*args) ⇒ Object
- #puts(*args) ⇒ Object
- #silenced? ⇒ Boolean
- #write(*args) ⇒ Object
Constructor Details
#initialize(silenced = false) ⇒ Base
Returns a new instance of Base.
10 11 12 |
# File 'lib/rink/output_method/base.rb', line 10 def initialize(silenced = false) @silenced = silenced end |
Instance Attribute Details
#silenced=(value) ⇒ Object (writeonly)
Sets the attribute silenced
4 5 6 |
# File 'lib/rink/output_method/base.rb', line 4 def silenced=(value) @silenced = value end |
Instance Method Details
#output ⇒ Object
6 7 8 |
# File 'lib/rink/output_method/base.rb', line 6 def output raise NotImplementedError, "output" end |
#print(*args) ⇒ Object
22 23 24 |
# File 'lib/rink/output_method/base.rb', line 22 def print(*args) raise NotImplementedError, "print" unless silenced? end |
#puts(*args) ⇒ Object
18 19 20 |
# File 'lib/rink/output_method/base.rb', line 18 def puts(*args) print args.join("\n"), "\n" end |
#silenced? ⇒ Boolean
26 27 28 |
# File 'lib/rink/output_method/base.rb', line 26 def silenced? @silenced end |
#write(*args) ⇒ Object
14 15 16 |
# File 'lib/rink/output_method/base.rb', line 14 def write(*args) print(*args) end |