Class: PdfParadise::Sinatra

Inherits:
Sinatra::Base
  • Object
show all
Includes:
Colours, EmbeddableInterface
Defined in:
lib/pdf_paradise/www/sinatra/app.rb

Constant Summary

Constants included from EmbeddableInterface

EmbeddableInterface::RARROW, EmbeddableInterface::USE_THIS_PORT, EmbeddableInterface::USE_THIS_UNIFORM_CSS_STYLE

Class Method Summary collapse

Instance Method Summary collapse

Methods included from EmbeddableInterface

#close_body, #close_html, #html_start_then_title, #input_type_submit, #input_type_user_input, #open_body, #open_html, #return_CSS_rules_to_use, #return_div_for_manual_pdf_conversion, #return_div_for_removing_the_first_page_of_this_pdf_file, #return_div_showing_all_available_books_if_we_are_on_a_roebe_system, #return_full_title, #return_index_of_hyperlinks, #return_link_to_root, #return_n_pdf_pages, #return_paragraph_of_hyperlinks, #return_root_string, #return_view_string, route_name?, #route_name?, set_route_name, #sub_routes?

Constructor Details

#initializeSinatra

#

initialize

#


44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/pdf_paradise/www/sinatra/app.rb', line 44

def initialize
  super()
  reset
  Dir.chdir('/home/Temp/') if File.directory? '/home/Temp'
  if ::PdfParadise.is_on_roebe?
    require 'open'
    # ===================================================================== #
    # Tell us which port will be used:
    # ===================================================================== #
    target = "http://localhost:#{USE_THIS_PORT}/"
    e sfancy(target)
    Thread.new {
      Open.in_browser(target) {{ delay: '1.0 seconds' }}
    }
  end
end

Class Method Details

.sub_routes?Boolean

#

PdfParadise::Sinatra.sub_routes?

#

Returns:

  • (Boolean)


37
38
39
# File 'lib/pdf_paradise/www/sinatra/app.rb', line 37

def self.sub_routes?
  PdfParadise::EmbeddableInterface.sub_routes?
end

Instance Method Details

#report_file_listingObject

#

report_file_listing

#


70
71
72
73
74
75
76
77
78
# File 'lib/pdf_paradise/www/sinatra/app.rb', line 70

def report_file_listing
  _ = '<p style="padding:1em; font-size: larger">'.dup
  _ << '<b>File listing from the directory: '+Dir.pwd+'</b><br><br>'
  Dir['*'].select {|entry| File.file?(entry) }.each {|entry|
    _ << "→ <b style=\"margin-left:3em\">#{entry}</b><br>"
  }
  _ << '</p>'
  _
end

#resetObject

#

reset

#


64
65
# File 'lib/pdf_paradise/www/sinatra/app.rb', line 64

def reset
end