Class: Racknga::Middleware::JSONP::Writer — racknga - ラングバ

Class: Racknga::Middleware::JSONP::Writer

Inherits:
Object
  • Object
show all
Defined in:
lib/racknga/middleware/jsonp.rb

Instance Method Summary (collapse)

Constructor Details

- (Writer) initialize(callback, body)

A new instance of Writer



137
138
139
140
# File 'lib/racknga/middleware/jsonp.rb', line 137

def initialize(callback, body)
  @callback = callback
  @body = body
end

Instance Method Details

- (Object) each(&block)



142
143
144
145
146
# File 'lib/racknga/middleware/jsonp.rb', line 142

def each(&block)
  block.call("#{@callback}(")
  @body.each(&block)
  block.call(");")
end