Class: BeautifulUrl::App

Inherits:
WebObject::Sinatra
  • Object
show all
Defined in:
lib/beautiful_url/www/app.rb

Overview

BeautifulUrl::App

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(commandline_arguments = nil, run_already = true) ⇒ App

#

initialize

#


36
37
38
39
40
41
42
43
44
45
46
# File 'lib/beautiful_url/www/app.rb', line 36

def initialize(
    commandline_arguments = nil,
    run_already           = true
  )
  super()
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  run if run_already
end

Class Method Details

.[](i = '') ⇒ Object

#

BeautifulUrl::App[]

#


160
161
162
# File 'lib/beautiful_url/www/app.rb', line 160

def self.[](i = '')
  new(i)
end

.start_sinatra_interfaceObject

#

BeautifulUrl::App.start_sinatra_interface

#


153
154
155
# File 'lib/beautiful_url/www/app.rb', line 153

def self.start_sinatra_interface
  ::BeautifulUrl::App.run!
end

Instance Method Details

#commandline_arguments?Boolean

#

commandline_arguments?

#

Returns:

  • (Boolean)


73
74
75
# File 'lib/beautiful_url/www/app.rb', line 73

def commandline_arguments?
  @commandline_arguments
end

#html_title(this_title = 'Translate URLs') ⇒ Object

#

html_title

#


140
141
142
# File 'lib/beautiful_url/www/app.rb', line 140

def html_title(this_title = 'Translate URLs')
  "<html><title>#{this_title}</title></html>"
end

#resetObject

#

reset (reset tag)

#


51
52
53
54
55
56
57
58
59
60
# File 'lib/beautiful_url/www/app.rb', line 51

def reset
  super()
  # ======================================================================= #
  # === @automatically_redirect_when_the_input_has_been_found
  #
  # If the next variable is set to true then we will automatically
  # redirect the visitor.
  # ======================================================================= #
  @automatically_redirect_when_the_input_has_been_found = false
end
#
#


131
132
133
134
135
# File 'lib/beautiful_url/www/app.rb', line 131

def return_proper_link_for(i)
  a(
    i, content: i, css_style: 'margin-left: 2em; font-weight: bold;'
  )
end

#runObject

#

run (run tag)

#


147
148
# File 'lib/beautiful_url/www/app.rb', line 147

def run
end

#set_commandline_arguments(i = '') ⇒ Object

#

set_input

#


65
66
67
68
# File 'lib/beautiful_url/www/app.rb', line 65

def set_commandline_arguments(i = '')
  i = [i].flatten.compact
  @commandline_arguments = i
end