Sha256: 796d0b1505596e0a1fc1942bf0fd5a45a8e865bf653e78038e1fb8a2c22c945e
Contents?: true
Size: 788 Bytes
Versions: 3
Compression:
Stored size: 788 Bytes
Contents
module Kernel def with_messages(prior = '', after = '', delimiter = true, output = $stdout) return unless block_given? prior = String(prior).to_s after = String(after).to_s output.puts prior.magenta unless prior == '' yield output.puts after.green unless after == '' output.puts "=".yellow * 50 if delimiter end def warning(*msg) warn "[WARNING] #{msg.join(' ')}".cyan end def exit_msg(*msg) abort "[ERROR] #{msg.join(' ')}".red end def within(path, ret = false) return unless block_given? initial = Dir.getwd Dir.chdir(path) val = yield Dir.chdir(initial) if ret return val rescue Errno::ENOENT exit_msg "The provided directory #{path} was not found! Aborting..." end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lessons_indexer-0.3.0 | lib/lessons_indexer/addons/utils.rb |
lessons_indexer-0.2.3 | lib/lessons_indexer/addons/utils.rb |
lessons_indexer-0.2.2 | lib/lessons_indexer/addons/utils.rb |