Class: Muwu::Viewer
- Inherits:
-
Object
show all
- Includes:
- Muwu
- Defined in:
- lib/muwu/viewer/viewer.rb
Constant Summary
Constants included
from Muwu
GEM_HOME_LIB, GEM_HOME_LIB_MUWU, VERSION
Instance Method Summary
collapse
Methods included from Muwu
debug, read
Constructor Details
#initialize(project) ⇒ Viewer
8
9
10
11
12
13
14
15
|
# File 'lib/muwu/viewer/viewer.rb', line 8
def initialize(project)
document_home = project.manifest.find_document_html_by_index(0)
if document_home
@document_home_filepath = File.join(project.path_compiled, document_home.filename)
else
raise ProjectExceptionHandler::Fatal.new(ProjectException::ViewerMissingHomeDocument.new)
end
end
|
Instance Method Details
#view ⇒ Object
21
22
23
24
25
26
27
|
# File 'lib/muwu/viewer/viewer.rb', line 21
def view
if @document_home_filepath && File.exist?(@document_home_filepath)
view_home_document
else
raise ProjectExceptionHandler::Fatal.new(ProjectException::ViewerMissingHomeDocument.new)
end
end
|
#view_home_document ⇒ Object
30
31
32
33
34
35
36
|
# File 'lib/muwu/viewer/viewer.rb', line 30
def view_home_document
begin
system "lynx #{@document_home_filepath}", exception: true
rescue Errno::ENOENT
raise ProjectExceptionHandler::Fatal.new(ProjectException::LynxNotAvailable.new)
end
end
|