Skip to content

Commit

Permalink
use camelize instead of classify to safe_constantize
Browse files Browse the repository at this point in the history
see #167
see #168
  • Loading branch information
aaronmallen committed Feb 10, 2020
1 parent f5c3049 commit dc91d22
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/active_interactor/context/loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module Loader
# @param interactor_class [Const] an {ActiveInteractor::Base interactor} class
# @return [Const] a class that inherits from {Base}
def self.create(context_class_name, interactor_class)
interactor_class.const_set(context_class_name.to_s.classify, Class.new(BASE_CONTEXT))
interactor_class.const_set(context_class_name.to_s.camelize, Class.new(BASE_CONTEXT))
end

# Find or create a {Base context} class for a given {ActiveInteractor::Base interactor}. If a class exists
Expand Down
2 changes: 1 addition & 1 deletion lib/active_interactor/interactor/context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def context_class
# @return [Const] the {Base interactor} class' {ActiveInteractor::Context::Base context} class
def contextualize_with(klass)
@context_class = begin
context_class = klass.to_s.classify.safe_constantize
context_class = klass.to_s.camelize.safe_constantize
raise(ActiveInteractor::Error::InvalidContextClass, klass) unless context_class

context_class
Expand Down
2 changes: 1 addition & 1 deletion lib/active_interactor/organizer/interactor_interface.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class InteractorInterface
# {Interactor::Perform::ClassMethods#perform .perform}. See {Interactor::Perform::Options}.
# @return [InteractorInterface] a new instance of {InteractorInterface}
def initialize(interactor_class, options = {})
@interactor_class = interactor_class.to_s.classify.safe_constantize
@interactor_class = interactor_class.to_s.camelize.safe_constantize
@filters = options.select { |key, _value| CONDITIONAL_FILTERS.include?(key) }
@perform_options = options.reject { |key, _value| CONDITIONAL_FILTERS.include?(key) }
end
Expand Down

0 comments on commit dc91d22

Please sign in to comment.