Class: Rubbr::Viewer::Base

Inherits:
Object
  • Object
show all
Includes:
Cli
Defined in:
lib/rubbr/viewer.rb

Direct Known Subclasses

Dvi, Pdf, Ps

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Cli

#color?, #disable_stderr, #disable_stdinn, #disable_stdout, #error, #executable?, #notice, #valid_executable, #warning

Constructor Details

#initializeBase

Returns a new instance of Base.



31
32
33
34
35
36
# File 'lib/rubbr/viewer.rb', line 31

def initialize
  @distribution_name = Rubbr.options[:distribution_name]

  @view_name = 'base'
  @executables = []
end

Instance Attribute Details

#distribution_nameObject

The name prefix of the distribution file.



24
25
26
# File 'lib/rubbr/viewer.rb', line 24

def distribution_name
  @distribution_name
end

Instance Method Details

#distribution_fileObject



26
27
28
29
# File 'lib/rubbr/viewer.rb', line 26

def distribution_file
  File.join(Rubbr.options[:distribution_dir],
            "#@distribution_name.#@view_name")
end

#find_viewerObject



38
39
40
41
42
# File 'lib/rubbr/viewer.rb', line 38

def find_viewer
  @executables.each do |executable|
    return executable if executable? executable
  end
end

#launchObject



44
45
46
47
48
49
# File 'lib/rubbr/viewer.rb', line 44

def launch
  return unless viewer = find_viewer
  fork { exec "#{viewer} #{distribution_file}" }
  notice "Display of #@view_name completed for: #{@distribution_name}" +
         ".#@view_name in #{Rubbr.options[:distribution_dir]}"
end