Class: Sparrowhawk::RailsWebXmlEntry

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ RailsWebXmlEntry

Returns a new instance of RailsWebXmlEntry.



6
7
8
9
10
# File 'lib/sparrowhawk/rails_web_xml_entry.rb', line 6

def initialize options={}
  super
  @runtimes = options[:runtimes] || (1..1)
  @environment = options[:environment] || 'development'
end

Instance Attribute Details

#environmentObject (readonly)

Returns the value of attribute environment.



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

def environment
  @environment
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

Instance Method Details

#contentObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/sparrowhawk/rails_web_xml_entry.rb', line 12

def content
  web_app do |xml|
    xml << context_param('rails.env', environment)
    xml << public_root
    xml << context_param('jruby.min.runtimes', min_runtimes)
    xml << context_param('jruby.max.runtimes', max_runtimes)
    xml << rack_filter
    xml << listener('org.jruby.rack.rails.RailsServletContextListener')
  end.target!
end

#max_runtimesObject



23
24
25
# File 'lib/sparrowhawk/rails_web_xml_entry.rb', line 23

def max_runtimes
  @runtimes.end.to_s
end

#min_runtimesObject



27
28
29
# File 'lib/sparrowhawk/rails_web_xml_entry.rb', line 27

def min_runtimes
  @runtimes.begin.to_s
end