Class: Clownfish::Adapter

Inherits:
Object
  • Object
show all
Defined in:
lib/clownfish/adapter.rb

Overview

Adapter between Anemone and clownfish objects.

Instance Method Summary collapse

Constructor Details

#initialize(clownfish) ⇒ Adapter

Internal: Create an Adapter that wraps a clownfish.

clownfish - Object that conforms to clownfish spec. See README.md.

Raises:

  • (ArgumentError)


7
8
9
10
# File 'lib/clownfish/adapter.rb', line 7

def initialize(clownfish)
  raise ArgumentError, "clownfish cannot be nil" if clownfish.nil?
  @delegate = clownfish
end

Instance Method Details

#anemone_optionsObject

Internal: Forwards Anemone options from clownfish.

Returns Hash of Anemone options, never nil.



15
16
17
# File 'lib/clownfish/adapter.rb', line 15

def anemone_options
  (@delegate.respond_to?(:anemone_options) && @delegate.anemone_options) || {}
end

#hook_into_anemone(anemone) ⇒ Object

Internal: Connects clownfish to Anemone.

anemone - Instance of Anemone::Core.

Returns nothing.



24
25
26
27
28
29
# File 'lib/clownfish/adapter.rb', line 24

def hook_into_anemone(anemone)
  wire_up_after_crawl(anemone)
  wire_up_on_every_page(anemone)
  wire_up_focus_crawl(anemone)
  relay_skip_links_like(anemone)
end