Module: Kernel

Defined in:
lib/coral_core.rb

Overview


Global namespace

Instance Method Summary collapse

Instance Method Details

#dbg(data, label = '') ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/coral_core.rb', line 15

def dbg(data, label = '')
  require 'pp'
  
  puts '>>----------------------'
  unless label.empty?
    puts label
    puts '---'
  end
  pp data
  puts '<<'
end

#locate(command) ⇒ Object




29
30
31
32
33
34
35
36
37
38
# File 'lib/coral_core.rb', line 29

def locate(command)
  exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
  ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
    exts.each do |ext|
      exe = File.join(path, "#{command}#{ext}")
      return exe if File.executable?(exe)
    end
  end
  return nil
end