Class: Rack::Typekit
- Inherits:
-
Object
- Object
- Rack::Typekit
- Defined in:
- lib/rack/typekit.rb
Constant Summary collapse
- VERSION =
"0.1.0"
Instance Method Summary collapse
- #_call(env) ⇒ Object
- #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.
8 9 10 11 |
# File 'lib/rack/typekit.rb', line 8 def initialize(app, = {}) raise ArgumentError, "Typekit Kit ID Required" unless [:kit] and ![:kit].empty? @app, @options = app, end |
Instance Method Details
#_call(env) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/rack/typekit.rb', line 15 def _call(env) @status, @headers, @response = @app.call(env) return [@status, @headers, @response] unless html? response = Rack::Response.new([], @status, @headers) @response.each { |fragment| response.write inject(fragment) } response.finish end |
#call(env) ⇒ Object
13 |
# File 'lib/rack/typekit.rb', line 13 def call(env); dup._call(env); end |