lib/praxis/plugin_concern.rb in praxis-2.0.pre.18 vs lib/praxis/plugin_concern.rb in praxis-2.0.pre.19

- old
+ new

@@ -1,42 +1,39 @@ -module Praxis +# frozen_string_literal: true +module Praxis module PluginConcern extend ::ActiveSupport::Concern included do @setup = false end module ClassMethods - PLUGIN_CLASSES = [ - :Request, - :Controller, - :EndpointDefinition, - :ActionDefinition, - :Response, - :ApiGeneralInfo - ] + PLUGIN_CLASSES = %i[ + Request + Controller + EndpointDefinition + ActionDefinition + Response + ApiGeneralInfo + ].freeze def setup! return if @setup PLUGIN_CLASSES.each do |name| - if self.constants.include?(name) - inject!(name) - end + inject!(name) if constants.include?(name) end @setup = true end def inject!(name) - plugin = self.const_get(name) + plugin = const_get(name) praxis = Praxis.const_get(name) praxis.include(plugin) end - end end - end