lib/plezi/handlers/controller_magic.rb in plezi-0.10.8 vs lib/plezi/handlers/controller_magic.rb in plezi-0.10.9

- old
+ new

@@ -24,22 +24,22 @@ public # the request object, class: HTTPRequest. attr_reader :request - # the ::params variable contains all the parameters set by the request (/path?locale=he => params["locale"] == "he"). + # the :params variable contains all the parameters set by the request (/path?locale=he => params ["locale"] == "he"). attr_reader :params - # a cookie-jar to get and set cookies (set: `cookie\[:name] = data` or get: `cookie\[:name]`). + # a cookie-jar to get and set cookies (set: `cookie [:name] = data` or get: `cookie [ :name ]`). # # Cookies and some other data must be set BEFORE the response's headers are sent. attr_reader :cookies # the HTTPResponse **OR** the WSResponse object that formats the response and sends it. use `response << data`. This object can be used to send partial data (such as headers, or partial html content) in blocking mode as well as sending data in the default non-blocking mode. attr_reader :response - # the ::flash is a little bit of a magic hash that sets and reads temporary cookies. + # the :flash is a little bit of a magic hash that sets and reads temporary cookies. # these cookies will live for one successful request to a Controller and will then be removed. attr_reader :flash # the parameters used to create the host (the parameters passed to the `listen` / `add_service` call). attr_reader :host_params @@ -164,14 +164,14 @@ options[:locale] ||= params[:locale].to_sym if params[:locale] # options[:locals] ||= {} I18n.locale = options[:locale] || I18n.default_locale if defined?(I18n) # sets the locale to nil for default behavior even if the locale was set by a previous action - removed: # && options[:locale] # find template and create template object filename = template.is_a?(String) ? File.join( host_params[:templates].to_s, template) : (File.join( host_params[:templates].to_s, *template.to_s.split('_')) + (options[:type].empty? ? '': ".#{options[:type]}") + '.slim') - return ( Plezi.cache_needs_update?(filename) ? Plezi.cache_data( filename, ( Slim::Template.new() { IO.read filename } ) ) : (Plezi.get_cached filename) ).render(self, &block) if defined?(::Slim) && Plezi.file_exists?(filename) + return ( Plezi.cache_needs_update?(filename) ? Plezi.cache_data( filename, ( Slim::Template.new() { IO.binread filename } ) ) : (Plezi.get_cached filename) ).render(self, &block) if defined?(::Slim) && Plezi.file_exists?(filename) filename.gsub! /\.slim$/, '.haml' - return ( Plezi.cache_needs_update?(filename) ? Plezi.cache_data( filename, ( Haml::Engine.new( IO.read(filename) ) ) ) : (Plezi.get_cached filename) ).render(self, &block) if defined?(::Haml) && Plezi.file_exists?(filename) + return ( Plezi.cache_needs_update?(filename) ? Plezi.cache_data( filename, ( Haml::Engine.new( IO.binread(filename) ) ) ) : (Plezi.get_cached filename) ).render(self, &block) if defined?(::Haml) && Plezi.file_exists?(filename) filename.gsub! /\.haml$/, '.erb' - return ( Plezi.cache_needs_update?(filename) ? Plezi.cache_data( filename, ( ERB.new( IO.read(filename) ) ) ) : (Plezi.get_cached filename) ).result(binding, &block) if defined?(::ERB) && Plezi.file_exists?(filename) + return ( Plezi.cache_needs_update?(filename) ? Plezi.cache_data( filename, ( ERB.new( IO.binread(filename) ) ) ) : (Plezi.get_cached filename) ).result(binding, &block) if defined?(::ERB) && Plezi.file_exists?(filename) return false end # returns the initial method called (or about to be called) by the router for the HTTP request. #