Class: Opal::PathReader
Instance Method Summary collapse
- #expand(path) ⇒ Object
-
#initialize(file_finder = HikePathFinder.new) ⇒ PathReader
constructor
A new instance of PathReader.
- #paths ⇒ Object
- #read(path) ⇒ Object
Constructor Details
#initialize(file_finder = HikePathFinder.new) ⇒ PathReader
Returns a new instance of PathReader
5 6 7
# File 'opal/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 'opal/lib/opal/path_reader.rb', line 15 def expand(path) file_finder.find(path) end
#paths ⇒ Object
19 20 21
# File 'opal/lib/opal/path_reader.rb', line 19 def paths file_finder.paths end
#read(path) ⇒ Object
9 10 11 12 13
# File 'opal/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