Sha256: 702f9eebf890f6b4d3a4a0350c389609bfb147cc3ef6bc33e05d0fcbcc32519e

Contents?: true

Size: 593 Bytes

Versions: 38

Compression:

Stored size: 593 Bytes

Contents

# Takes care of ensuring the Content-Type is set to application/xhtml+xml
# for docomo devices as is required to use xhtml instead of text/html.  If
# text/html is used, the content is rendered as the vastly inferior i-mode
# html (aka CHTML).
class Galakei::Filter::ContentType < Galakei::Filter::Base
  def self.inject(klass)
    this_class = self
    klass.after_filter self, :if => lambda {|c| this_class.condition?(c) }
  end

  def condition?
    request.docomo? && %r{text/html} =~ response.content_type
  end

  def filter
    response.content_type = 'application/xhtml+xml'
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
galakei-0.12.0 lib/galakei/filter/content_type.rb
galakei-0.11.3 lib/galakei/filter/content_type.rb
galakei-0.11.2 lib/galakei/filter/content_type.rb
galakei-0.11.1 lib/galakei/filter/content_type.rb
galakei-0.11.0 lib/galakei/filter/content_type.rb
galakei-0.10.1 lib/galakei/filter/content_type.rb
galakei-0.10.0 lib/galakei/filter/content_type.rb
galakei-0.9.1 lib/galakei/filter/content_type.rb
galakei-0.9.0 lib/galakei/filter/content_type.rb
galakei-0.8.1 lib/galakei/filter/content_type.rb
galakei-0.8.0 lib/galakei/filter/content_type.rb
galakei-0.7.3 lib/galakei/filter/content_type.rb
galakei-0.7.2 lib/galakei/filter/content_type.rb
galakei-0.7.1 lib/galakei/filter/content_type.rb
galakei-0.7.0 lib/galakei/filter/content_type.rb
galakei-0.6.6 lib/galakei/filter/content_type.rb
galakei-0.6.5 lib/galakei/filter/content_type.rb
galakei-0.6.4 lib/galakei/filter/content_type.rb
galakei-0.6.3 lib/galakei/filter/content_type.rb
galakei-0.6.2 lib/galakei/filter/content_type.rb