Sha256: f36ea4a2a76fb25dd1111993f6760bf1d7fe33fbc02b19cd9c2b737e0503c9c6
Contents?: true
Size: 856 Bytes
Versions: 15
Compression:
Stored size: 856 Bytes
Contents
module Screengem module Factories # # Makes actions available to tasks. # class ActionFactory < BasicObject def method_missing(action_name, *args) # rubocop:disable Style/MethodMissingSuper action_class_name = raw_action_class_name(action_name).camelize action_class = "#{action_scope}::#{action_class_name}".constantize action_class.new(*args) rescue => e ActionError.new(<<~MSG) Unable to create action: '#{action_class_name}'. Details: #{e.message} MSG end def respond_to_missing?(_action_name, *) true end class ActionError < ::Screengem::Action include FactoryCreationError end private def action_scope @action_scope ||= ::Screengem.configuration.action_scope end end end end
Version data entries
15 entries across 15 versions & 1 rubygems