Module: Termiro
- Defined in:
- lib/termiro.rb,
lib/termiro/version.rb
Defined Under Namespace
Classes: Error
Constant Summary collapse
- COLORS =
{ r: "\u001b[41m \u001b[0m", y: "\u001b[43m \u001b[0m", b: "\u001b[44m \u001b[0m", g: "\u001b[42m \u001b[0m", m: "\u001b[45m \u001b[0m", c: "\u001b[46m \u001b[0m", w: "\u001b[47m \u001b[0m", x: "\u001b[40m \u001b[0m"}
- VERSION =
"0.1.0"
Class Method Summary collapse
Class Method Details
.draw(file) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/termiro.rb', line 15 def self.draw(file) graphic = "" lines= File.readlines("graphics/#{file}.txt") lines.each do |line| line.each_char do |color| if color == '-' # if character not int colors graphic += ' ' else graphic += COLORS[color.to_sym].to_s end end graphic += "\n" end puts graphic end |