lib/nitro/caching/actions.rb in nitro-0.20.0 vs lib/nitro/caching/actions.rb in nitro-0.21.0
- old
+ new
@@ -4,60 +4,60 @@
# Adds support for caching.
module Caching
- # Action caching.
+ # Action caching.
- module Actions
+ module Actions
- def self.append_features(base) # :nodoc:
- super
- base.extend(ClassMethods)
- end
+ def self.append_features(base) # :nodoc:
+ super
+ base.extend(ClassMethods)
+ end
- module ClassMethods
+ module ClassMethods
- def cache_action(*actions)
- return unless caching_enabled?
-
- before_filter(
- %{
- fragment_name = "\#\{@action_name\}\#{@request.query_string}"
- if fragment = Fragment.get(fragment_name)
- @out = fragment
- return
- end
- },
- :only => actions
- )
-
- after_filter(
- %{
- fragment_name = "\#\{@action_name\}\#{@request.query_string}"
- Fragment.put(fragment_name, @out)
- },
- :only => actions
- )
- end
-
- end
+ def cache_action(*actions)
+ return unless caching_enabled?
+
+ before_filter(
+ %{
+ fragment_name = "\#\{@action_name\}\#{@request.query_string}"
+ if fragment = Fragment.get(fragment_name)
+ @out = fragment
+ return
+ end
+ },
+ :only => actions
+ )
+
+ after_filter(
+ %{
+ fragment_name = "\#\{@action_name\}\#{@request.query_string}"
+ Fragment.put(fragment_name, @out)
+ },
+ :only => actions
+ )
+ end
+
+ end
- private
+ private
- #--
- # FIXME: not implemented.
- #++
-
- def expire_action(*actions)
- return unless caching_enabled?
+ #--
+ # FIXME: not implemented.
+ #++
+
+ def expire_action(*actions)
+ return unless caching_enabled?
- for action in [actions].flatten
- expire_fragment(action)
- end
- end
+ for action in [actions].flatten
+ expire_fragment(action)
+ end
+ end
- end
+ end
end
end