Module: BrewCaskTools::Util

Defined in:
lib/bct/util.rb

Overview

Shared helper methods

Constant Summary collapse

GEM_PATH =
Pathname.new(__FILE__).join('../../..').expand_path

Class Method Summary collapse

Class Method Details

.relative_path(*relative) ⇒ Object

Relative path from working directory



21
22
23
# File 'lib/bct/util.rb', line 21

def relative_path(*relative)
  Pathname.pwd.join(*relative.flatten.map(&:to_s)).expand_path
end

.source_path(*relative) ⇒ Object



25
26
27
# File 'lib/bct/util.rb', line 25

def source_path(*relative)
  GEM_PATH.join(*relative.flatten.map(&:to_s)).expand_path
end

.to_array(arg) ⇒ Object

Transform helpers



14
15
16
# File 'lib/bct/util.rb', line 14

def to_array(arg)
  arg.is_a?(Array) ? arg : [arg]
end