lib/hx/listing/recursiveindex.rb in hx-0.6.1 vs lib/hx/listing/recursiveindex.rb in hx-0.7.0

- old
+ new

@@ -28,29 +28,29 @@ module Hx module Listing class RecursiveIndex - include Hx::Source + include Hx::Filter - def self.new(source, options) - listing = super(source, options) + def self.new(input, options) + listing = super(input, options) if options.has_key? :limit listing = Limit.new(listing, :limit => options[:limit]) end if options.has_key? :page_size listing = Paginate.new(listing, :page_size => options[:page_size]) end listing end - def initialize(source, options) - @source = source + def initialize(input, options) + @input = input end def each_entry indexes = Hash.new { |h,k| h[k] = {'items' => []} } - @source.each_entry do |path, entry| + @input.each_entry do |path, entry| components = path.split("/") until components.empty? components.pop index_path = (components + ["index"]).join("/") index = indexes[index_path]