Class: Rack::XMLStylesheet

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/xml_stylesheet.rb,
lib/rack/xml_stylesheet/version.rb

Defined Under Namespace

Modules: Strategy

Constant Summary collapse

VERSION =
version.gsub(/^v?([^\+]+)\+?\d*$/, '\1')

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, *args) ⇒ XMLStylesheet

Returns a new instance of XMLStylesheet.



8
9
10
11
12
# File 'lib/rack/xml_stylesheet.rb', line 8

def initialize(app, *args)
  @app = app
  @options = args.last.is_a?(Hash) ? args.last : {}
  @strategy = Strategy::Rails23
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/rack/xml_stylesheet.rb', line 6

def options
  @options
end

Instance Method Details

#call(env) ⇒ Object



14
15
16
17
18
# File 'lib/rack/xml_stylesheet.rb', line 14

def call(env)
  result = @app.call(env)
  @strategy.new(result, options).add_processing_instructions
  result
end