Sha256: b1779cb14866ce5da59a6b8a2305bf861c3d34cc38c621e8d73ea5d5ef1d0e89
Contents?: true
Size: 1.05 KB
Versions: 51
Compression:
Stored size: 1.05 KB
Contents
# frozen_string_literal: true module Plutonium module Engine module Validator extend ActiveSupport::Concern class_methods do # Validates that the current engine supports Plutonium features. # # @raise [ArgumentError] If the engine doesn't include Plutonium::Engine. # @return [void] def validate_engine!(engine) return if supported_engine?(engine) # TODO: make the error link to documentation on how to ensure that your engine is supported raise ArgumentError, "#{engine} must include Plutonium::Engine to call register resources" end # Checks if the current engine supports Plutonium features. # # @return [Boolean] True if the engine includes Plutonium::Engine, false otherwise. def supported_engine?(engine) # TODO: fix constant being out of sync after reload during development Plutonium.configuration.development? ? engine.respond_to?(:dom_id) : engine.include?(Plutonium::Engine) end end end end end
Version data entries
51 entries across 51 versions & 1 rubygems