Module: Ramaze::Helper::Feeds

Defined in:
lib/cortex_reaver/helper/feeds.rb

Overview

Adds an atom method to each controller it’s included in, which lists that controller’s recent elements by yielding a block with each record and a builder object for the feed.

Requires crud. Will attempt to cache feeds if the cache helper is available.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/cortex_reaver/helper/feeds.rb', line 13

def self.included(base)
  base.instance_eval do
    def self.for_feed(&block)
      @for_feed_block = block
    end

    def self.for_feed_block
      @for_feed_block
    end

    # Cache feeds
    if base.respond_to? :cache_action
      base.cache_action(:method => :atom, :ttl => 300)
    end
  end
end

Instance Method Details

#atomObject



30
31
32
# File 'lib/cortex_reaver/helper/feeds.rb', line 30

def atom
  atom_builder
end