Class: ConcordionReader

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

Instance Method Summary collapse

Instance Method Details

#find_on_load_path(filename) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/concordion_reader.rb', line 7

def find_on_load_path(filename)
  return filename if File.exists?(filename) 
  
  $LOAD_PATH.each {|path|
    candidate = "#{path}/#{filename}"
    return candidate if File.exists?(candidate)
  }

  raise "Could not find #{filename} on the system load path!"
end

#read(filename) ⇒ Object



3
4
5
# File 'lib/concordion_reader.rb', line 3

def read(filename)
  IO.read(find_on_load_path(filename))
end