Class: Quadtone::Tools::Print

Inherits:
Quadtone::Tool show all
Defined in:
lib/quadtone/tools/print.rb

Instance Attribute Summary collapse

Attributes inherited from Quadtone::Tool

#profile, #verbose

Instance Method Summary collapse

Methods inherited from Quadtone::Tool

#load_profile, #parse_global_option, process_args, #process_environment

Constructor Details

#initializePrint

Returns a new instance of Print.



10
11
12
13
# File 'lib/quadtone/tools/print.rb', line 10

def initialize
  super
  @printer_options = {}
end

Instance Attribute Details

#calibrateObject

Returns the value of attribute calibrate.



7
8
9
# File 'lib/quadtone/tools/print.rb', line 7

def calibrate
  @calibrate
end

#printer_optionsObject

Returns the value of attribute printer_options.



8
9
10
# File 'lib/quadtone/tools/print.rb', line 8

def printer_options
  @printer_options
end

Instance Method Details

#parse_option(option, args) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/quadtone/tools/print.rb', line 15

def parse_option(option, args)
  case option
  when '--calibrate'
    @calibrate = true
  when '--option', '--options'
    @printer_options.merge!(
      Hash[
        args.shift.split(',').map { |o| o.split('=') }
      ]
    )
  end
end

#run(*args) ⇒ Object



28
29
30
31
32
# File 'lib/quadtone/tools/print.rb', line 28

def run(*args)
  args.map { |p| Path.new(p) }.each do |image_path|
    @profile.print_file(image_path, calibrate: @calibrate, printer_options: @printer_options)
  end
end