Module: Memorb::Integration

Defined in:
lib/memorb/integration.rb

Class Method Summary collapse

Class Method Details

.[](integrator) ⇒ Object



25
26
27
# File 'lib/memorb/integration.rb', line 25

def [](integrator)
  INTEGRATIONS.read(integrator)
end

.integrate_with!(target) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/memorb/integration.rb', line 9

def integrate_with!(target)
  unless target.is_a?(::Class)
    raise InvalidIntegrationError, 'integration target must be a class'
  end
  INTEGRATIONS.fetch(target) do
    new(target).tap do |integration|
      target.singleton_class.prepend(IntegratorClassMethods)
      target.prepend(integration)
    end
  end
end

.integrated?(target) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/memorb/integration.rb', line 21

def integrated?(target)
  INTEGRATIONS.has?(target)
end