class Dictionaries::Sinatra

Constants

USE_THIS_PORT
#

USE_THIS_PORT

#

Public Class Methods

new( i = ARGV ) click to toggle source
#

initialize

#
Calls superclass method
# File lib/dictionaries/sinatra/app.rb, line 38
def initialize(
    i = ARGV
  )
  super()
  reset
  consider_opening_the_page_in_the_browser(i)
end

Public Instance Methods

consider_opening_the_page_in_the_browser( shall_we_open_the_page_in_the_browser = ::Dictionaries.is_on_roebe? ) click to toggle source
#

consider_opening_the_page_in_the_browser

#
# File lib/dictionaries/sinatra/app.rb, line 55
def consider_opening_the_page_in_the_browser(
    shall_we_open_the_page_in_the_browser = ::Dictionaries.is_on_roebe?
  )
  case shall_we_open_the_page_in_the_browser
  # ======================================================================= #
  # === :do_not_open_in_the_browser
  # ======================================================================= #
  when :do_not_open_in_the_browser,
       :dont_connect,
       :dont
    shall_we_open_the_page_in_the_browser = false
  end
  if shall_we_open_the_page_in_the_browser
    begin
      require 'open'
    rescue LoadError; end
    # ===================================================================== #
    # Tell us which port will be used:
    # ===================================================================== #
    target = "http://localhost:#{USE_THIS_PORT}/"
    e sfancy(target)
    Thread.new {
      sleep 0.8
      Open.in_browser(target)
    }
  end
end
html_header_default_title_and_start_of_the_body_tag() click to toggle source
#

html_header_default_title_and_start_of_the_body_tag

#
# File lib/dictionaries/sinatra/english_to_german.rb, line 49
def html_header_default_title_and_start_of_the_body_tag
  return Dictionaries::HelperModule.html_header_default_title_and_start_of_the_body_tag
end
reset() click to toggle source
#

reset (reset tag)

#
# File lib/dictionaries/sinatra/app.rb, line 49
def reset
end
return_english_to_german_form() click to toggle source
#

return_english_to_german_form

#
# File lib/dictionaries/sinatra/english_to_german.rb, line 28
def return_english_to_german_form
  route_to_this_action = '/english_to_german/'
  html_header_default_title_and_start_of_the_body_tag+
  h5('Input an english word to see the translation.')+
  div(css_style: 'padding: 0.1em') {
    p(
      '<b>Enter the word here:</b>',
      css_style: 'padding: 0.15em'
    )+
    form(action: route_to_this_action,
             id: 'english_to_german',
      css_style: 'margin-left:1em; margin-top:2px') {
      '<input type="text" name="user_input" style="border:3px solid slateblue; padding: 4px"><br>'+
      return_search_button
    }
  }
end
return_search_button() click to toggle source
#

return_search_button

#
# File lib/dictionaries/sinatra/english_to_german.rb, line 56
def return_search_button
  return Dictionaries::HelperModule.return_search_button
end