Class: Mayu::Resources::Resolver::Static

Inherits:
Base
  • Object
show all
Defined in:
lib/mayu/resources/resolver/static.rb

Instance Attribute Summary

Attributes inherited from Base

#resolved_paths

Instance Method Summary collapse

Constructor Details

#initialize(paths) ⇒ Static

Returns a new instance of Static.



11
12
13
14
15
# File 'lib/mayu/resources/resolver/static.rb', line 11

def initialize(paths)
  super()
  @resolved_paths = paths
  # Console.logger.info(self, *@resolved_paths.map { "#{_1} => #{_2}" })
end

Instance Method Details

#resolve(path, source_dir = "/") ⇒ Object



20
21
22
23
# File 'lib/mayu/resources/resolver/static.rb', line 20

def resolve(path, source_dir = "/")
  relative_to_root = File.absolute_path(path, source_dir)
  @resolved_paths[relative_to_root] || relative_to_root
end