class RBT::Sinatra

Constants

IS_ROEBE
#

IS_ROEBE

#
TITLE
#

TITLE

#
USE_THIS_PORT
#

USE_THIS_PORT

#

Public Class Methods

new() click to toggle source
#

initialize

#
Calls superclass method
# File lib/rbt/sinatra/app.rb, line 79
def initialize
  super()
  reset
  if IS_ROEBE
    require 'open'
    # ===================================================================== #
    # Tell us which port will be used:
    # ===================================================================== #
    target = "http://localhost:#{USE_THIS_PORT}/"
    e sfancy(target)
    Thread.new {
      sleep 1.0
      Open.in_browser(target)
    }
  end
end

Public Instance Methods

abr(i, hash) click to toggle source
#

abr

#
# File lib/rbt/sinatra/app.rb, line 171
def abr(i, hash)
  HtmlTags.a(i, hash)+br
end
reset() click to toggle source
#

reset

#
# File lib/rbt/sinatra/app.rb, line 99
def reset
end
return_available_actions() click to toggle source
#

return_available_actions

This method will list the available (registered) actions for the web-interface.

#
# File lib/rbt/sinatra/app.rb, line 146
def return_available_actions
  p('The following entry points are available:')+
  p(css_style: 'padding:10px; margin-left: 1em') {
    # ===================================================================== #
    # === /view
    # ===================================================================== #
    abr('/view',     content: '/view',   css_style: :bold)+
    # ===================================================================== #
    # === /create
    # ===================================================================== #
    abr('/create',   content: '/create', css_style: :bold)+
    # ===================================================================== #
    # === /available_programs
    # ===================================================================== #
    abr('/available_programs', content: '/available_programs', css_style: :bold)+
    # ===================================================================== #
    # === /install
    # ===================================================================== #
    abr('/install',  content: '/install', css_style: :bold) # /install
  }
end
return_html_head_and_title_and_body() click to toggle source
#

return_html_head_and_title_and_body

#
# File lib/rbt/sinatra/app.rb, line 123
def return_html_head_and_title_and_body
  '<html><head><title>'+TITLE+'</title></head><body>'
end
return_main_index() click to toggle source
#

return_main_index

This method will return the main “index” - the first “page” that someone sees when using the sinatra-interface.

#
# File lib/rbt/sinatra/app.rb, line 133
def return_main_index
  return_html_head_and_title_and_body+
  'This is the <b>www-interface</b> for the RBT '\
  'project, using <b>sinatra</b>.'+
  return_available_actions
end