Sha256: cb14f49c2824248d4e5c4309242f7eed46d1b77ebe4a405e2c04c2787677e613

Contents?: true

Size: 777 Bytes

Versions: 2

Compression:

Stored size: 777 Bytes

Contents

module Awestruct
  module Extensions
    class Atomizer
      def initialize(entries_name, output_path, opts={})
        @entries_name = entries_name
        @output_path = output_path
        @num_entries = opts[:num_entries] || 50
      end

      def execute(site)
        entries = site.send( @entries_name )
        unless ( @num_entries == :all )
          entries = entries[0,@num_entries]
        end
        input_page = File.join( File.dirname(__FILE__), 'template.atom.haml' )
        page = site.engine.load_page( input_page )
        page.date = page.timestamp unless page.timestamp.nil?
        page.output_path = @output_path
        page.entries = entries
        page.title = site.title || site.base_url
        site.pages << page
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
awestruct-0.1.8 lib/awestruct/extensions/atomizer.rb
awestruct-0.1.7 lib/awestruct/extensions/atomizer.rb