Class: Sparrowhawk::RackWebXmlEntry

Inherits:
WebXmlEntry show all
Defined in:
lib/sparrowhawk/rack_web_xml_entry.rb

Instance Attribute Summary

Attributes inherited from WebXmlEntry

#name

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ RackWebXmlEntry

Returns a new instance of RackWebXmlEntry


3
4
5
6
# File 'lib/sparrowhawk/rack_web_xml_entry.rb', line 3

def initialize options={}
  super
  @rackup_file = options[:rackup]
end

Instance Method Details

#contentObject


8
9
10
11
12
13
14
15
# File 'lib/sparrowhawk/rack_web_xml_entry.rb', line 8

def content
  web_app do |xml|
    xml << public_root
    xml << context_param('rackup', rackup) if rackup?
    xml << rack_filter
    xml << listener('org.jruby.rack.RackServletContextListener')
  end.target!
end

#rackupObject


17
18
19
# File 'lib/sparrowhawk/rack_web_xml_entry.rb', line 17

def rackup
  @rackup ||= IO.read(@rackup_file)
end

#rackup?Boolean

Returns:

  • (Boolean)

21
22
23
# File 'lib/sparrowhawk/rack_web_xml_entry.rb', line 21

def rackup?
  @rackup_file && File.exists?(@rackup_file)
end