class Main
Constants
- HORIZONTAL_BORDER
- LEFT_DOWN_CORNER
- LEFT_UP_CORNER
- RIGHT_DOWN_CORNER
- RIGHT_UP_CORNER
- VERTICAL_BORDER
Attributes
alfabet[R]
commands[R]
row_size[R]
Public Class Methods
new(row_size, commands, alfabet)
click to toggle source
# File lib/freshmind.rb, line 48 def initialize(row_size, commands, alfabet) @row_size = row_size @commands = commands @alfabet = alfabet end
Public Instance Methods
out()
click to toggle source
# File lib/freshmind.rb, line 60 def out puts top_border result.each_slice(row_size) do |row| puts VERTICAL_BORDER + " " + row.join(" ") + " " + VERTICAL_BORDER end puts bottom_border end
result()
click to toggle source
# File lib/freshmind.rb, line 54 def result alfabet.map do |l| l + commands[rand(300)].red end end
Private Instance Methods
bottom_border()
click to toggle source
# File lib/freshmind.rb, line 77 def bottom_border LEFT_DOWN_CORNER + line + RIGHT_DOWN_CORNER end
line()
click to toggle source
# File lib/freshmind.rb, line 70 def line HORIZONTAL_BORDER * (row_size * 3 + 1) end
top_border()
click to toggle source
# File lib/freshmind.rb, line 74 def top_border LEFT_UP_CORNER + line + RIGHT_UP_CORNER end