class SvelteOnRails::Lib::ViewHelperSupport
def initialize(file, props, request, caching = false)
def initialize(file, props, request, caching = false) @start_time = Time.now @filename = (file.match(/\.svelte$/) ? file[0..-8] : file) @conf = SvelteOnRails::Configuration.instance @all_arguments = props @helper_options, @html_options, @props, @props_json = split_props( props, %i[class id style], %i[ssr hydrate debug cache_key expires_in] ) @request = request @ssr = determine_ssr validate_file if @conf.watch_changes? # precompile if !Dir.exist?(@conf.ssr_dist_folder) || @conf.watch_changes? SvelteOnRails::Lib::Utils.watch_changes_and_precompile end # caching if caching raise '[svelte-on-rails] Caching required but Redis is not defined' unless defined?(Redis) else raise '[svelte-on-rails] :expires_in is not allowed for this helper' if @helper_options.key?(:expires_in) raise '[svelte-on-rails] :cache_key is not allowed for this helper' if @helper_options.key?(:cache_key) return end return unless ssr? generate_cache_key end