mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-18 00:00:12 +01:00
29 lines
539 B
Ruby
29 lines
539 B
Ruby
module ActionController
|
|
class StringCoercion
|
|
class UglyBody < ActiveSupport::BasicObject
|
|
def initialize(body)
|
|
@body = body
|
|
end
|
|
|
|
def each
|
|
@body.each do |part|
|
|
yield part.to_s
|
|
end
|
|
end
|
|
|
|
private
|
|
def method_missing(*args, &block)
|
|
@body.__send__(*args, &block)
|
|
end
|
|
end
|
|
|
|
def initialize(app)
|
|
@app = app
|
|
end
|
|
|
|
def call(env)
|
|
status, headers, body = @app.call(env)
|
|
[status, headers, UglyBody.new(body)]
|
|
end
|
|
end
|
|
end
|