Class: Sparrowhawk::WebXmlEntry
- Inherits:
-
Object
- Object
- Sparrowhawk::WebXmlEntry
- Defined in:
- lib/sparrowhawk/web_xml_entry.rb
Instance Attribute Summary collapse
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #content ⇒ Object
-
#initialize(options = {}) ⇒ WebXmlEntry
constructor
A new instance of WebXmlEntry.
- #max_runtimes ⇒ Object
- #min_runtimes ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ WebXmlEntry
Returns a new instance of WebXmlEntry.
8 9 10 11 12 |
# File 'lib/sparrowhawk/web_xml_entry.rb', line 8 def initialize ={} @name = 'WEB-INF/web.xml' @runtimes = [:runtimes] || (1..1) @environment = [:environment] || 'development' end |
Instance Attribute Details
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
6 7 8 |
# File 'lib/sparrowhawk/web_xml_entry.rb', line 6 def environment @environment end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/sparrowhawk/web_xml_entry.rb', line 6 def name @name end |
Instance Method Details
#content ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/sparrowhawk/web_xml_entry.rb', line 14 def content xml = Builder::XmlMarkup.new xml.instruct! xml.declare!(:DOCTYPE, 'web-app'.to_sym, :PUBLIC, "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN", "http://java.sun.com/dtd/web-app_2_3.dtd") xml.tag! 'web-app' do |xml| xml << context_param('rails.env', environment) xml << context_param('public.root', '/') xml << context_param('jruby.min.runtimes', min_runtimes) xml << context_param('jruby.max.runtimes', max_runtimes) xml << filter(:name => 'RackFilter', :class => 'org.jruby.rack.RackFilter', :url => '/*') xml << listener('org.jruby.rack.rails.RailsServletContextListener') end xml.target! end |
#max_runtimes ⇒ Object
33 34 35 |
# File 'lib/sparrowhawk/web_xml_entry.rb', line 33 def max_runtimes @runtimes.end.to_s end |
#min_runtimes ⇒ Object
37 38 39 |
# File 'lib/sparrowhawk/web_xml_entry.rb', line 37 def min_runtimes @runtimes.begin.to_s end |