Module: Kubec::Utils::Path

Defined in:
lib/kubec/utils/path.rb

Overview

:nodoc:

Class Method Summary collapse

Class Method Details

.dotfile?(path) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
12
13
14
15
# File 'lib/kubec/utils/path.rb', line 8

def dotfile?(path)
  path
    .split('/')
    .last
    .split('.')
    .first
    .empty?
end

.with_stage(path) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/kubec/utils/path.rb', line 17

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