class Wayfarer::Frontiers::MemoryTrieFrontier

An in-memory trie. @api private

Public Class Methods

new(config) click to toggle source
# File lib/wayfarer/frontiers/memory_trie_frontier.rb, line 10
def initialize(config)
  @trie = Trie.new
  super(config)
end

Public Instance Methods

cache(*uris) click to toggle source

@override

# File lib/wayfarer/frontiers/memory_trie_frontier.rb, line 16
def cache(*uris)
  uris.each { |uri| @trie.add(uri.to_s) }
end
cached?(uri) click to toggle source
# File lib/wayfarer/frontiers/memory_trie_frontier.rb, line 25
def cached?(uri)
  # RuboCop autocorrects `#has_key?` to `#key?` otherwise
  # rubocop:disable Style/PreferredHashMethods
  @trie.has_key?(uri.to_s)
  # rubocop:enable Style/PreferredHashMethods
end
free() click to toggle source

@override

# File lib/wayfarer/frontiers/memory_trie_frontier.rb, line 33
def free
  @trie = nil
  super
end
match!(uri) click to toggle source

@override

# File lib/wayfarer/frontiers/memory_trie_frontier.rb, line 21
def match!(uri)
  @str_or_regexp === uri.host
end