Class: StimulusReflex::ReflexFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/stimulus_reflex/reflex_factory.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(channel, data) ⇒ ReflexFactory

Returns a new instance of ReflexFactory.



8
9
10
11
# File 'lib/stimulus_reflex/reflex_factory.rb', line 8

def initialize(channel, data)
  @channel = channel
  @data = StimulusReflex::ReflexData.new(data)
end

Instance Attribute Details

#channelObject (readonly)

Returns the value of attribute channel.



4
5
6
# File 'lib/stimulus_reflex/reflex_factory.rb', line 4

def channel
  @channel
end

#dataObject (readonly)

Returns the value of attribute data.



4
5
6
# File 'lib/stimulus_reflex/reflex_factory.rb', line 4

def data
  @data
end

Instance Method Details

#callObject



13
14
15
16
# File 'lib/stimulus_reflex/reflex_factory.rb', line 13

def call
  verify_method_name!
  reflex_class.new(channel, reflex_data: data)
end