Sha256: 2f586c9b7bb4df5b140d7fcd9b1512f7e8e43e78f776ee6f549d5a28fe134c21
Contents?: true
Size: 704 Bytes
Versions: 2
Compression:
Stored size: 704 Bytes
Contents
# frozen_string_literal: true module JsDependency module PathnameUtility # @param [Pathname] pathname # @return [Pathname] def self.complement_extname(pathname) return pathname if pathname.exist? || pathname.extname != "" %w[.js .jsx .vue].each do |ext| next unless pathname.sub_ext(ext).file? return pathname.sub_ext(ext) end pathname end # @param [String] target_path # @return [Pathname] def self.to_target_pathname(target_path) if Pathname.new(target_path).relative? && Pathname.new(target_path).exist? Pathname.new(target_path).realpath else Pathname.new(target_path) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
js_dependency-0.3.2 | lib/js_dependency/pathname_utility.rb |
js_dependency-0.3.1 | lib/js_dependency/pathname_utility.rb |