Class: Rack::Typekit
- Inherits:
-
Object
- Object
- Rack::Typekit
- Defined in:
- lib/rack/typekit.rb
Constant Summary collapse
- VERSION =
"0.2.0"
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ Typekit
constructor
A new instance of Typekit.
Constructor Details
#initialize(app, options = {}) ⇒ Typekit
Returns a new instance of Typekit.
6 7 8 9 10 |
# File 'lib/rack/typekit.rb', line 6 def initialize(app, = {}) raise ArgumentError, "Typekit Kit ID Required" unless [:kit] && ![:kit].empty? @app, @options = app, end |
Instance Method Details
#call(env) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/rack/typekit.rb', line 12 def call(env) @status, @headers, @response = @app.call(env) return [@status, @headers, @response] unless html? response = Rack::Response.new([], @status, @headers) if @response.respond_to?(:to_ary) @response.each { |fragment| response.write inject_typekit(fragment) } end response.finish end |