Sha256: eff5037f0486edee3d7d2f8b0935ff49f890a12e3af0c55827f1a8481b3ff2b7

Contents?: true

Size: 696 Bytes

Versions: 9

Compression:

Stored size: 696 Bytes

Contents

# frozen_string_literal: true

module Weneedfeed
  module Views
    class ShowFeed < Base
      include ::Weneedfeed::Helpers::Parameters

      # @param [Weneedfeed::Page] page
      def initialize(page:, **argv)
        super(**argv)
        @page = page
      end

      private

      # @return [String]
      def top_page_path
        request.path.delete_suffix(router.path(:feed, page_id: page_id))
      end

      # @return [Enumerable<Weneedfeed::Item>]
      def items
        @page.items.sort_by do |item|
          -(item.time || ::Time.now).to_i
        end.take(10)
      end

      # @return [String]
      def page_id
        path_parameters[:page_id]
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
weneedfeed-0.20.0 lib/weneedfeed/views/show_feed.rb
weneedfeed-0.19.3 lib/weneedfeed/views/show_feed.rb
weneedfeed-0.19.2 lib/weneedfeed/views/show_feed.rb
weneedfeed-0.19.1 lib/weneedfeed/views/show_feed.rb
weneedfeed-0.19.0 lib/weneedfeed/views/show_feed.rb
weneedfeed-0.18.0 lib/weneedfeed/views/show_feed.rb
weneedfeed-0.17.0 lib/weneedfeed/views/show_feed.rb
weneedfeed-0.16.1 lib/weneedfeed/views/show_feed.rb
weneedfeed-0.16.0 lib/weneedfeed/views/show_feed.rb