Sha256: 3def1abc7f833cf959c1a31497f2d0c72b17909e4911df51a19e83fde6045dd5
Contents?: true
Size: 1.24 KB
Versions: 3
Compression:
Stored size: 1.24 KB
Contents
# frozen_string_literal: true require 'eac_ruby_utils/core_ext' module EacTemplates module Sources class FsObject enable_abstract_methods enable_simple_cache common_constructor :source_set, :subpath do self.subpath = subpath.to_pathname end # @return [Boolean] def found? real_paths.any? end protected # @return [Class] def applier_class raise_abstract_method __method__ end # @return [EacTemplates::Variables::SourceFile] def applier_uncached raise "No #{self.class.name.downcase} found for \"#{subpath}\"" unless found? applier_class.new(real_paths.first) end # @return [Array<Pathname>] def real_paths_uncached source_set.included_paths.lazy.map { |source_single| source_single_search(source_single) } .select(&:present?) end # @param path [Pathname] # @return [Boolean] def select_path?(path) path.present? end # @param source_single [EacTemplates::Sources::Single] # @return [Pathname, nil] def source_single_search(source_single) r = source_single.search(subpath) select_path?(r) ? r : nil end end end end
Version data entries
3 entries across 3 versions & 2 rubygems