Class: Rink::OutputMethod::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/rink/output_method/base.rb

Direct Known Subclasses

IO

Instance Attribute Summary collapse

Instance Method Summary collapse

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

Parameters:

  • value

    the value to set the attribute silenced to.



4
5
6
# File 'lib/rink/output_method/base.rb', line 4

def silenced=(value)
  @silenced = value
end

Instance Method Details

#outputObject

Raises:

  • (NotImplementedError)


6
7
8
# File 'lib/rink/output_method/base.rb', line 6

def output
  raise NotImplementedError, "output"
end

Raises:

  • (NotImplementedError)


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

Returns:

  • (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