class Hanami::Assets::Config::Sources

Source directories for a specific application

@since 0.1.0 @api private

@see Hanami::Assets.duplicate @see www.rubydoc.info/gems/hanami-utils/Hanami/Utils/LoadPaths

TODO The perf of this class is poor, consider to improve it.

Constants

SKIPPED_FILE_PREFIX

@since 0.3.0 @api private

Attributes

root[W]

@since 0.1.0 @api private

Public Class Methods

new(root) click to toggle source

@since 0.1.0 @api private

Calls superclass method
# File lib/hanami/assets/config/sources.rb, line 33
def initialize(root)
  super()
  @root = root
end

Public Instance Methods

files(name = nil) click to toggle source

@since 0.1.0 @api private

# File lib/hanami/assets/config/sources.rb, line 58
def files(name = nil)
  result = []

  Utils::FileList[map { |source| "#{source}#{::File::SEPARATOR}**#{::File::SEPARATOR}#{name}*" }].each do |file|
    next if ::File.directory?(file) || ::File.basename(file).start_with?(SKIPPED_FILE_PREFIX)

    result << file
  end

  result
end
find(filename) click to toggle source

@since 0.1.0 @api private

# File lib/hanami/assets/config/sources.rb, line 50
def find(filename)
  result = files(filename).first
  result = Pathname.new(result) unless result.nil?
  result
end
map() { |source| ... } click to toggle source

@since 0.1.0 @api private

# File lib/hanami/assets/config/sources.rb, line 40
def map
  [].tap do |result|
    each do |source|
      result << yield(source)
    end
  end
end

Private Instance Methods

realpath(path) click to toggle source

@since 0.1.0 @api private

# File lib/hanami/assets/config/sources.rb, line 74
def realpath(path)
  @root.join(path).realpath
end