class Weneedfeed::Capture
Public Class Methods
call( base_url:, schema_path: )
click to toggle source
@param [String] base_url @param [String] schema_path
# File lib/weneedfeed/capture.rb, line 11 def call( base_url:, schema_path: ) new( base_url: base_url, schema_path: schema_path ).call end
new( base_url:, schema_path: )
click to toggle source
@param [String] base_url @param [String] schema_path
# File lib/weneedfeed/capture.rb, line 24 def initialize( base_url:, schema_path: ) @base_url = base_url @schema_path = schema_path end
Public Instance Methods
call()
click to toggle source
# File lib/weneedfeed/capture.rb, line 32 def call urls.each do |url| ::Rack::Capture.call( app: app, script_name: script_name, url: url ) end end
Private Instance Methods
app()
click to toggle source
@return [Weneedfeed::Application]
# File lib/weneedfeed/capture.rb, line 45 def app @app ||= ::Weneedfeed::Application.new( schema: ::YAML.load_file(@schema_path) ) end
base_uri()
click to toggle source
@return [URI]
# File lib/weneedfeed/capture.rb, line 52 def base_uri @base_uri ||= ::URI.parse(@base_url) end
schema()
click to toggle source
@return [Hash]
# File lib/weneedfeed/capture.rb, line 57 def schema ::YAML.load_file(@schema_path) end
script_name()
click to toggle source
@return [String]
# File lib/weneedfeed/capture.rb, line 62 def script_name case base_uri.path when '', '/' '' else base_uri.path end end
urls()
click to toggle source
@return [Array<String>]
# File lib/weneedfeed/capture.rb, line 72 def urls app.paths.map do |path| [ @base_url, path ].join end end