Module: Repackage::EmbeddableInterface

Defined in:
lib/repackage/www/embeddable_interface.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.routes?Boolean

#

Repackage::EmbeddableInterface.routes?

Define all legal routes via this Array. This Array will then be used to add more routes to any sinatra-application that needs it.

#

Returns:

  • (Boolean)


17
18
19
20
21
22
# File 'lib/repackage/www/embeddable_interface.rb', line 17

def self.routes?
  [
    'repackage',
    'repackage/*'
  ]
end

Instance Method Details

#return_sinatra_repackageObject

#

return_sinatra_repackage

#


27
28
29
30
# File 'lib/repackage/www/embeddable_interface.rb', line 27

def return_sinatra_repackage
  'Please provide the name of the target archive that is to '\
  'be repackaged.'
end

#return_sinatra_repackage_with_arguments(i = web_params_as_string? ) ⇒ Object

#

return_sinatra_repackage_with_arguments

#


35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/repackage/www/embeddable_interface.rb', line 35

def return_sinatra_repackage_with_arguments(
    i = web_params_as_string?
  )
  i = i.dup if i.frozen?
  _ = ''.dup
  _ << 'The parameters given were: <b style="darkblue">'+i+'</b><br>'
  i.prepend('/') unless i.start_with? '/'
  if File.exist? i
    _ << 'Repackaging this file next.<br>'
    result = ::Repackage.new(i) {
      :do_not_delete_the_old_source
    }
    _ << 'The archive is now available at: <b>'+
          result.the_final_location_is_at?.to_s+
          '</b>'
  else
    _ << 'No file exists at '+i
  end
  return _
end