20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/knossoscli/cli.rb', line 20
def carve
params = {}
params[:rows] = options[:rows].to_i if options[:rows]
params[:columns] = options[:columns].to_i if options[:columns]
grid = Knossos::Grid.new(params)
carver = Knossos::Algorithm.const_get(options[:algorithm])
carver.carve(grid: grid)
text_renderer = Knossos::Renderer::Text.new
puts text_renderer.render(grid: grid)
if options[:image]
image_renderer = Knossos::Renderer::Image.new(grid)
image = image_renderer.render
image.save(options[:image])
end
end
|