Class: EngineAssets::PublicLocator

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

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.pathsObject (readonly)

Returns the value of attribute paths.



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

def paths
  @paths
end

Class Method Details

.locate(file_path) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/engine_assets/public_locator.rb', line 14

def locate(file_path)
  full_paths = paths.map { |base_path| File.join(base_path, file_path) }
  full_paths.each do |full_path|
    return full_path if File.exist?(full_path)
  end
  nil
end

.register(full_path) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/engine_assets/public_locator.rb', line 5

def register(full_path)
  @paths ||= []

  public_path = File.join(full_path, 'public')
  File.open(public_path) {}

  paths << public_path
end