Class: KrakendOpenAPI::FileReader
- Inherits:
-
Object
- Object
- KrakendOpenAPI::FileReader
- Defined in:
- lib/readers/file_reader.rb
Overview
Reads absolute/relative files
Instance Method Summary collapse
-
#initialize(file_path) ⇒ FileReader
constructor
A new instance of FileReader.
- #read ⇒ Object
Constructor Details
#initialize(file_path) ⇒ FileReader
Returns a new instance of FileReader.
6 7 8 |
# File 'lib/readers/file_reader.rb', line 6 def initialize(file_path) @file_path = file_path end |
Instance Method Details
#read ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/readers/file_reader.rb', line 10 def read pwd = File.(Dir.pwd) if Pathname.new(@file_path).absolute? File.read(@file_path) else File.read(File.(@file_path, pwd)) end end |