Class: Opal::PathReader

Inherits:
Object
  • Object
show all
Defined in:
lib/opal/path_reader.rb

Instance Method Summary collapse

Constructor Details

#initialize(file_finder = HikePathFinder.new) ⇒ PathReader


5
6
7
# File 'lib/opal/path_reader.rb', line 5

def initialize(file_finder = HikePathFinder.new)
  @file_finder = file_finder
end

Instance Method Details

#expand(path) ⇒ Object


15
16
17
# File 'lib/opal/path_reader.rb', line 15

def expand(path)
  file_finder.find(path)
end

#pathsObject


19
20
21
# File 'lib/opal/path_reader.rb', line 19

def paths
  file_finder.paths
end

#read(path) ⇒ Object


9
10
11
12
13
# File 'lib/opal/path_reader.rb', line 9

def read(path)
  full_path = expand(path)
  return nil if full_path.nil?
  File.read(full_path)
end