Sha256: 3c1c18b8a1542f419e573994f73720937c1021869b5d4fd064dd6e419c86378e
Contents?: true
Size: 1.19 KB
Versions: 3
Compression:
Stored size: 1.19 KB
Contents
# frozen_string_literal: true class StimulusReflex::ReflexFactory class << self attr_reader :reflex_data def create_reflex_from_data(channel, reflex_data) @reflex_data = reflex_data reflex_class.new(channel, url: reflex_data.url, element: reflex_data.element, selectors: reflex_data.selectors, method_name: reflex_data.method_name, params: reflex_data.params, client_attributes: { id: reflex_data.id, tab_id: reflex_data.tab_id, xpath_controller: reflex_data.xpath_controller, xpath_element: reflex_data.xpath_element, reflex_controller: reflex_data.reflex_controller, permanent_attribute_name: reflex_data.permanent_attribute_name, suppress_logging: reflex_data.suppress_logging, version: reflex_data.version, npm_version: reflex_data.npm_version }) end def reflex_class reflex_data.reflex_name.constantize.tap { |klass| raise ArgumentError.new("#{reflex_name} is not a StimulusReflex::Reflex") unless is_reflex?(klass) } end def is_reflex?(klass) klass.ancestors.include? StimulusReflex::Reflex end end end
Version data entries
3 entries across 3 versions & 1 rubygems