Sha256: 7f060c20d4b97b7abefd06343405447b7013a4d899e9c9687c8056a3e4ece3f8

Contents?: true

Size: 441 Bytes

Versions: 1

Compression:

Stored size: 441 Bytes

Contents

# -*- coding: utf-8 -*-
require 'katakanaize/version'
require 'rack/response'
require 'nkf'

class Katakanaize
  def initialize(app)
    @app = app
  end

  def call(env)
    response = @app.call(env)
    body = response[2][0]
    new_body = NKF.nkf('-wh2', body)
    new_response = Rack::Response.new do |res|
      res.status = 200
      res['Content-Type'] = 'text/html'
      res.write new_body
    end
    new_response.finish
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
katakanaize-0.0.1 lib/katakanaize.rb