Class: Rack::App::CLI::Fetcher::Server

Inherits:
Server
  • Object
show all
Defined in:
lib/rack/app/cli/fetcher/server.rb

Defined Under Namespace

Classes: Options

Constant Summary collapse

Abort =
Class.new(StandardError)

Instance Method Summary collapse

Instance Method Details

#abort(*messages) ⇒ Object

Raises:



30
31
32
# File 'lib/rack/app/cli/fetcher/server.rb', line 30

def abort(*messages)
  raise(Abort)
end

#appObject



24
25
26
27
28
# File 'lib/rack/app/cli/fetcher/server.rb', line 24

def app
  super
rescue Abort
  Class.new(Rack::App)
end

#get_rack_appObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rack/app/cli/fetcher/server.rb', line 3

def get_rack_app
  app_class = self.app
  last_app = nil
  until app_class.is_a?(Class) && app_class <= Rack::App
    raise if app_class.__id__ == last_app.__id__

    app_class.instance_variables.each do |ivar|
      value = app_class.instance_variable_get(ivar)
      if value.respond_to?(:call) and not [Method, Proc, UnboundMethod].include?(value.class)
        app_class = value
      end
    end

    last_app = app_class
  end
  app_class
rescue
end

#opt_parserObject



40
41
42
# File 'lib/rack/app/cli/fetcher/server.rb', line 40

def opt_parser
  Options.new
end