Method: BatchFile#initialize

Defined in:
lib/pik/batch_file.rb

#initialize(file, mode = :new) {|_self| ... } ⇒ BatchFile

Returns a new instance of BatchFile.

Yields:

  • (_self)

Yield Parameters:

  • _self (BatchFile)

    the object that the method was called on



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/pik/batch_file.rb', line 12

def initialize(file, mode=:new)
  @rubyw_exe = 'rubyw.exe'
  @ruby_exe  = 'ruby.exe'
  @file = Pathname.new(file)
  case mode
  when :open
    @file_data = File.read(@file).split("\n")
  when :new
    @file_data = [header]
  end
  yield self if block_given?
end