Class: TRMNLP::ScreenGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/trmnlp/screen_generator.rb

Instance Method Summary collapse

Constructor Details

#initialize(html, opts = {}) ⇒ ScreenGenerator

Returns a new instance of ScreenGenerator.



8
9
10
11
12
13
14
# File 'lib/trmnlp/screen_generator.rb', line 8

def initialize(html, opts = {})
  @input = html
  @screenshot = opts[:screenshot]
  @requested_width = opts[:width]
  @requested_height = opts[:height]
  @requested_color_depth = opts[:color_depth]
end

Instance Method Details

#processObject



16
17
18
19
20
# File 'lib/trmnlp/screen_generator.rb', line 16

def process
  output = @screenshot.call(html: @input, width:, height:)
  ImageQuantizer.new(depth: color_depth).call(output.path)
  output
end