Sha256: c66f119d4eba633668668fb463f79e876fb0367a7c424a92082411f10be40ab7

Contents?: true

Size: 658 Bytes

Versions: 5

Compression:

Stored size: 658 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_name.xml', to: ::Weneedfeed::Controllers::ShowFeed, as: :feed
    end

    # @param [Hash] schema
    def initialize(schema:)
      @schema = schema
      super()
    end

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

    # @return [Array<String>]
    def paths
      ['/'] + @schema['pages'].keys.map do |page_name|
        "/feeds/#{page_name}.xml"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
weneedfeed-0.5.0 lib/weneedfeed/application.rb
weneedfeed-0.4.1 lib/weneedfeed/application.rb
weneedfeed-0.4.0 lib/weneedfeed/application.rb
weneedfeed-0.3.0 lib/weneedfeed/application.rb
weneedfeed-0.2.0 lib/weneedfeed/application.rb