Module: Localite::NodeFilter

Defined in:
lib/localite/node_filter.rb

Defined Under Namespace

Modules: Etest

Class Method Summary collapse

Class Method Details

.filter(controller, &block) ⇒ Object

set up filter for this action.



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/localite/node_filter.rb', line 6

def self.filter(controller, &block)
  yield
    
  return unless controller.response.headers["Content-Type"] =~ /text\/html/
  r = controller.response
  r.body = filter_body r.body, Localite.current_locale
rescue
  if Rails.env.development?
    controller.response.body = "Caught exception: " + CGI::escapeHTML($!.inspect) 
  end
  raise
end

.included(klass) ⇒ Object



19
20
21
# File 'lib/localite/node_filter.rb', line 19

def self.included(klass)
  klass.send :around_filter, self
end