Class: Teri::FileAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/teri/accounting.rb

Overview

File adapter for handling file operations This allows for better testing by injecting a test adapter

Instance Method Summary collapse

Instance Method Details

#exist?(path) ⇒ Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/teri/accounting.rb', line 32

def exist?(path)
  File.exist?(path)
end

#open(path, mode) ⇒ Object



44
45
46
# File 'lib/teri/accounting.rb', line 44

def open(path, mode, &)
  File.open(path, mode, &)
end

#read(path) ⇒ Object



36
37
38
# File 'lib/teri/accounting.rb', line 36

def read(path)
  File.read(path)
end

#readlines(path) ⇒ Object



40
41
42
# File 'lib/teri/accounting.rb', line 40

def readlines(path)
  File.readlines(path)
end

#warning(message) ⇒ Object



48
49
50
# File 'lib/teri/accounting.rb', line 48

def warning(message)
  puts "Warning: #{message}"
end