Method: Opal::Hike::Index#find

Defined in:
lib/opal/hike.rb

#find(logical_path) ⇒ Object

The real implementation of find. Trail#find generates a one time index and delegates here.

See Trail#find for usage.



70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/opal/hike.rb', line 70

def find(logical_path)
  base_path = Pathname.new(@root)
  logical_path = Pathname.new(logical_path.sub(/^\//, ''))

  if logical_path.to_s =~ %r{^\.\.?/}
    find_in_base_path(logical_path, base_path) { |path| return path }
  else
    find_in_paths(logical_path) { |path| return path }
  end

  nil
end