Class: Opal::CLI::PathFinder

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

Overview

RUN CODE

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pathsObject

Returns the value of attribute paths

Returns:

  • (Object)

    the current value of paths



40
41
42
# File 'opal/lib/opal/cli.rb', line 40

def paths
  @paths
end

Instance Method Details

#find(filename) ⇒ Object



41
42
43
44
45
46
47
48
# File 'opal/lib/opal/cli.rb', line 41

def find(filename)
  full_path = nil
  _path = paths.find do |path|
    full_path = File.join(path, filename)
    File.exist? full_path
  end
  full_path or raise(ArgumentError, "file: #{filename} not found")
end