Class: Quadtone::Tools::PrinterOptions

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

Instance Attribute Summary collapse

Attributes inherited from Quadtone::Tool

#profile, #verbose

Instance Method Summary collapse

Methods inherited from Quadtone::Tool

#parse_global_option, process_args, #process_environment

Instance Attribute Details

#printerObject

Returns the value of attribute printer.



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

def printer
  @printer
end

#show_attributesObject

Returns the value of attribute show_attributes.



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

def show_attributes
  @show_attributes
end

Instance Method Details

#load_profileObject



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

def load_profile
  false
end

#parse_option(option, args) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/quadtone/tools/printer_options.rb', line 14

def parse_option(option, args)
  case option
  when '--printer'
    @printer = Printer.new(args.shift)
  when '--show-attributes'
    @show_attributes = true
  end
end

#run(*args) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/quadtone/tools/printer_options.rb', line 23

def run(*args)
  if @printer
    printer = @printer
  elsif @profile
    printer = @profile.printer
  else
    raise ToolUsageError, "Must specify either printer or profile"
  end
  printer.show_attributes if @show_attributes
  printer.show_options
  printer.show_inks
end