Files
danbooru/app/controllers/sources_controller.rb
evazion d9d3c1dfe4 sources: rename Sources::Strategies to Source::Extractor.
Rename Sources::Strategies to Source::Extractor. A Source::Extractor
represents a thing that extracts information from a given URL.
2022-03-24 03:49:44 -05:00

15 lines
373 B
Ruby

# frozen_string_literal: true
class SourcesController < ApplicationController
respond_to :js, :json, :xml
def show
@source = Source::Extractor.find(params[:url], params[:ref])
respond_with(@source.to_h) do |format|
format.xml { render xml: @source.to_h.to_xml(root: "source") }
format.json { render json: @source.to_h.to_json }
end
end
end