Class: ShatteredMachine::ProgressivePixelSorter
- Inherits:
-
Object
- Object
- ShatteredMachine::ProgressivePixelSorter
- Defined in:
- lib/shattered_machine/progressive_pixel_sorter.rb
Overview
Call the pixel sorter multiple time in steps for given png image(s)
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(io, options) ⇒ ProgressivePixelSorter
constructor
A new instance of ProgressivePixelSorter.
Constructor Details
#initialize(io, options) ⇒ ProgressivePixelSorter
Returns a new instance of ProgressivePixelSorter.
9 10 11 12 13 14 |
# File 'lib/shattered_machine/progressive_pixel_sorter.rb', line 9 def initialize(io, ) @io = io @options = @images_count = @io.png_images.count @steps = define_steps end |
Instance Method Details
#call ⇒ Object
16 17 18 19 20 |
# File 'lib/shattered_machine/progressive_pixel_sorter.rb', line 16 def call @io.png_images.sort_by { |path| [path.input[/\d+/].to_i, path.input] }.each_with_index do |item, index| PixelSorter.new((index)).call(item.input, item.output) end end |