Module: Kreuzcrawl::CrawlEvent

Extended by:
T::Helpers, T::Sig
Included in:
CrawlEventComplete, CrawlEventError, CrawlEventPage
Defined in:
lib/kreuzcrawl/native.rb

Overview

An event emitted during a streaming crawl operation.

Not available on ‘wasm32` targets — streaming requires native concurrency primitives (tokio channels, `JoinSet`) that are not supported on wasm32.

Delivered to bindings through each target’s native streaming idiom.

Class Method Summary collapse

Class Method Details

.from_hash(hash) ⇒ Object



120
121
122
123
124
125
126
127
128
# File 'lib/kreuzcrawl/native.rb', line 120

def self.from_hash(hash)
  discriminator = hash[:type] || hash["type"]
  case discriminator
  when "page" then CrawlEventPage.from_hash(hash)
  when "error" then CrawlEventError.from_hash(hash)
  when "complete" then CrawlEventComplete.from_hash(hash)
  else raise "Unknown discriminator: #{discriminator}"
  end
end