Class: Quadtone::Tools::Chart

Inherits:
Quadtone::Tool show all
Defined in:
lib/quadtone/tools/chart.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

Instance Attribute Details

#openObject

Returns the value of attribute open.



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

def open
  @open
end

#quick_lookObject

Returns the value of attribute quick_look.



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

def quick_look
  @quick_look
end

Instance Method Details

#parse_option(option, args) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/quadtone/tools/chart.rb', line 10

def parse_option(option, args)
  case option
  when '--open'
    @open = true
  when '--quicklook'
    @quicklook = true
  end
end

#runObject



19
20
21
22
23
24
25
# File 'lib/quadtone/tools/chart.rb', line 19

def run
  html_path = @profile.html_path
  html_path.open('w') { |io| io.write(profile.to_html) }
  ;;warn "Saved HTML to #{html_path}"
  system 'open', html_path if @open
  system 'qlmanage', '-p', html_path if @quick_look
end