Skip to content

Commit

Permalink
Allow to specify the entries directly as an Array instead of reading …
Browse files Browse the repository at this point in the history
…them from site
  • Loading branch information
goldmann committed Apr 18, 2012
1 parent 495870f commit ecdd7d9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/awestruct/extensions/atomizer.rb
Expand Up @@ -2,16 +2,16 @@ module Awestruct
module Extensions module Extensions
class Atomizer class Atomizer


def initialize(entries_name, output_path, opts={}) def initialize(entries, output_path, opts={})
@entries_name = entries_name @entries = entries
@output_path = output_path @output_path = output_path
@num_entries = opts[:num_entries] || 50 @num_entries = opts[:num_entries] || 50
@content_url = opts[:content_url] @content_url = opts[:content_url]
@feed_title = opts[:feed_title] @feed_title = opts[:feed_title]
end end


def execute(site) def execute(site)
entries = site.send( @entries_name ) || [] entries = @entries.is_a?(Array) ? @entries : site.send( @entries ) || []
unless ( @num_entries == :all ) unless ( @num_entries == :all )
entries = entries[0, @num_entries] entries = entries[0, @num_entries]
end end
Expand Down

0 comments on commit ecdd7d9

Please sign in to comment.