Class: Yadriggy::FilePrinter

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

Overview

Pretty printer to a file.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Printer

#<<, #down, #nl, #output, #up

Constructor Details

#initialize(file_name) ⇒ FilePrinter

Returns a new instance of FilePrinter.

Parameters:

  • file_name (String)

    the file name.



72
73
74
75
76
# File 'lib/yadriggy/printer.rb', line 72

def initialize(file_name)
  super()
  @text = File.open(file_name, 'w')
  @file_name = file_name
end

Instance Attribute Details

#file_nameString (readonly)

Returns the file name.

Returns:

  • (String)

    the file name.



69
70
71
# File 'lib/yadriggy/printer.rb', line 69

def file_name
  @file_name
end

Instance Method Details

#closeObject



78
79
80
# File 'lib/yadriggy/printer.rb', line 78

def close
  @text.close
end