Class: MmunicodeRails::RackMmunicode

Inherits:
Object
  • Object
show all
Includes:
Core
Defined in:
lib/mmunicode_rails.rb

Instance Method Summary collapse

Methods included from Core

#detect_font, #uni512zg1, #zg12uni51

Constructor Details

#initialize(app) ⇒ RackMmunicode

Returns a new instance of RackMmunicode.



288
289
290
# File 'lib/mmunicode_rails.rb', line 288

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
# File 'lib/mmunicode_rails.rb', line 293

def call(env)
  request = Rack::Request.new env
  #This monkey patching is a hack for rack 1.4.5 compatibility required for rails 3.2.*
  unless request.respond_to? :update_param then
    request.instance_eval do
      def update_param(k, v)
            found = false
            if self.GET.has_key?(k)
              found = true
              self.GET[k] = v
            end
            if self.POST.has_key?(k)
              found = true
              self.POST[k] = v
            end
            unless found
              self.GET[k] = v
            end
            @params = nil
            nil
      end
    end
  end
  converted_params = []
  request.params.each_pair do|key,value|
    puts "#{key}: #{value}"
  end
  converted_params = nested_param_traversal(request.params)
  
  converted_params.each_pair do|key,value|
    puts "#{key}: #{value}"
    request.update_param(key, value)
  end
  @app.call(env)
end