Sha256: c9d6ac8ae29e599597a0d0e0c9117411d0ee7619576c925bfb534d75dff1a626

Contents?: true

Size: 528 Bytes

Versions: 3

Compression:

Stored size: 528 Bytes

Contents

# frozen_string_literal: true

module Kubec
  module Utils
    # :nodoc:
    module Path
      class << self
        def dotfile?(path)
          path
            .split('/')
            .last
            .split('.')
            .first
            .empty?
        end

        def with_stage(path)
          path.split('.').tap do |ary|
            ext = ary.pop unless dotfile?(path)
            ary.push(fetch(:stage, :staging))
            ary.push(ext) if ext
          end.join('.')
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kubec-0.6.1 lib/kubec/utils/path.rb
kubec-0.6.0 lib/kubec/utils/path.rb
kubec-0.5.0 lib/kubec/utils/path.rb