Module: Above::Utils

Defined in:
lib/above/utils.rb

Overview

Utility functions

Class Method Summary collapse

Class Method Details

.check_keys(expected_keys:, file:, hash:) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/above/utils.rb', line 6

def check_keys(expected_keys:, file:, hash:)
  if !expected_keys.all? { |key| hash.key? key }
    puts "Missing keys - #{file}"
    (expected_keys - hash.keys).each { |key| puts key }
    exit
  end
end

.home_dirObject



14
15
16
17
18
19
20
21
# File 'lib/above/utils.rb', line 14

def home_dir
  path = if RUBY_PLATFORM.match?(/cygwin | mswin | mingw | bccwin | wince | emx /)
    "%userprofile%"
  else
    "~"
  end
  File.expand_path(path)
end