Sha256: e5fa50a580360312e05ecc98217c38ddaefa45ac0945fb735f4cee8baebea0c4

Contents?: true

Size: 804 Bytes

Versions: 8

Compression:

Stored size: 804 Bytes

Contents

# frozen_string_literal: true

require 'hibana'

module Weneedfeed
  class Application < ::Hibana::Application
    route do
      get '/', to: ::Weneedfeed::Controllers::ShowTopPage, as: :top_page
      get '/feeds/:page_id.xml', to: ::Weneedfeed::Controllers::ShowFeed, as: :feed
      get '/opml.xml', to: ::Weneedfeed::Controllers::ShowOpml, as: :opml
    end

    # @param [String] schema_path
    def initialize(schema_path:)
      @schema = ::Weneedfeed::Schema.load_file(schema_path)
      super()
    end

    # @param [Hash] env
    def call(env)
      env['weneedfeed.schema'] = @schema
      super
    end

    # @return [Array<String>]
    def paths
      %w[
        /
        /opml.xml
      ] + @schema.page_ids.map do |page_id|
        "/feeds/#{page_id}.xml"
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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