Parent

Warbler::Traits::War::WebxmlOpenStruct

Helper class for holding arbitrary config.webxml values for injecting into web.xml.

Public Class Methods

new(key = 'webxml') click to toggle source
# File lib/warbler/traits/war.rb, line 152
def initialize(key = 'webxml')
  @key = key
  @table = Hash.new { |h, k| h[k] = WebxmlOpenStruct.new(k) }
end

Public Instance Methods

[](key) click to toggle source
# File lib/warbler/traits/war.rb, line 168
def [](key)
  new_ostruct_member(key)
  send(key)
end
[]=(key, value) click to toggle source
# File lib/warbler/traits/war.rb, line 173
def []=(key, value)
  new_ostruct_member(key)
  send("#{key}=", value)
end
context_params(escape = true) click to toggle source
# File lib/warbler/traits/war.rb, line 178
def context_params(escape = true)
  require 'cgi'
  params = {}
  @table.each do |k,v|
    case v
    when WebxmlOpenStruct
      nested_params = v.context_params
      nested_params.each do |nk,nv|
        params["#{escape ? CGI::escapeHTML(k.to_s) : k.to_s}.#{nk}"] = nv
      end
    else
      params[escape ? CGI::escapeHTML(k.to_s) : k.to_s] = escape ? CGI::escapeHTML(v.to_s) : v.to_s
    end
  end
  extra_ignored = Array === ignored ? ignored : []
  params.delete_if {|k,v| ['ignored', *extra_ignored].include?(k.to_s) }
  params
end
servlet_context_listener() click to toggle source
# File lib/warbler/traits/war.rb, line 157
def servlet_context_listener
  case self.booter
  when :rack
    "org.jruby.rack.RackServletContextListener"
  when :merb
    "org.jruby.rack.merb.MerbServletContextListener"
  else # :rails, default
    "org.jruby.rack.rails.RailsServletContextListener"
  end
end
to_s() click to toggle source
# File lib/warbler/traits/war.rb, line 197
def to_s
  "No value for '#@key' found"
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.