Module: StimulusReflex::CableReadiness

Included in:
Reflex
Defined in:
lib/stimulus_reflex/cable_readiness.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cable_readyObject (readonly)

Returns the value of attribute cable_ready.



5
6
7
# File 'lib/stimulus_reflex/cable_readiness.rb', line 5

def cable_ready
  @cable_ready
end

Instance Method Details

#initialize(*args, **kwargs) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/stimulus_reflex/cable_readiness.rb', line 7

def initialize(*args, **kwargs)
  super(*args, **kwargs)

  if is_a? CableReady::Broadcaster
    message = <<~MSG

      #{self.class.name} includes CableReady::Broadcaster, and you need to remove it.
      Reflexes have their own CableReady interface. You can just assume that it's present.
      See https://docs.stimulusreflex.com/guide/cableready#using-cableready-inside-a-reflex-action for more details.

    MSG
    raise TypeError.new(message.strip)
  end
  @cable_ready = StimulusReflex::CableReadyChannels.new(self)
end