module Gemwarrior::Hr
Public Instance Methods
print(*patterns)
click to toggle source
# File lib/gemwarrior/misc/hr.rb, line 11 def print(*patterns) Kernel.print string(*patterns) end
string(*patterns)
click to toggle source
# File lib/gemwarrior/misc/hr.rb, line 15 def string(*patterns) options = patterns.last.is_a?(Hash) ? patterns.pop : {} screen_width = GameOptions.data['wrap_width'] output = patterns.map do |pattern| pattern = pattern.to_s times = (screen_width / pattern.length) + 1 (pattern * times)[0..screen_width - 1] end.join output << "\n" options = options.inject({}){|tmp,(k,v)| tmp[k.to_sym] = v.to_sym; tmp} options.any? ? output.colorize(options) : output end
Private Instance Methods
command_exists?(command)
click to toggle source
# File lib/gemwarrior/misc/hr.rb, line 30 def command_exists?(command) ENV['PATH'].split(File::PATH_SEPARATOR).any? { |path| (File.exist? File.join(path, "#{command}")) || (File.exist? File.join(path, "#{command}.com")) || (File.exist? File.join(path, "#{command}.exe")) } end