Sha256: ef9b0ac6300ed83219cda48b72b250e5821c56088973564a5603b2a8ce278bab
Contents?: true
Size: 533 Bytes
Versions: 28
Compression:
Stored size: 533 Bytes
Contents
module Locomotive module Middlewares class Permalink def initialize(app, opts = {}) @app = app end def call(env) if env['PATH_INFO'] =~ /^#{Locomotive.mounted_on}\/_permalink.json/ request = Rack::Request.new(env) underscore = request.params['underscore'] == '1' value = request.params['string'].try(:permalink, underscore) [200, {}, [{ value: value }.to_json]] else @app.call(env) end end end end end
Version data entries
28 entries across 28 versions & 2 rubygems