Module: Gemwarrior::Hr
Instance Method Summary collapse
Instance Method Details
#print(*patterns) ⇒ Object
11 12 13 |
# File 'lib/gemwarrior/misc/hr.rb', line 11 def print(*patterns) Kernel.print string(*patterns) end |
#string(*patterns) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/gemwarrior/misc/hr.rb', line 15 def string(*patterns) = 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" = .inject({}){|tmp,(k,v)| tmp[k.to_sym] = v.to_sym; tmp} .any? ? output.colorize() : output end |