lib/emittance/action.rb in emittance-0.1.3 vs lib/emittance/action.rb in emittance-1.0.0

- old
+ new

@@ -142,13 +142,11 @@ Emittance::Event.event_klass_for action_klass end # @private def find_or_create_klass(klass_name) - unless Object.const_defined? klass_name - set_namespaced_constant_by_name klass_name, Class.new - end + set_namespaced_constant_by_name(klass_name, Class.new) unless Object.const_defined?(klass_name) Object.const_get klass_name end private @@ -193,14 +191,13 @@ watch Emittance::Action.emitting_event_identifier(action_klass) do |event| handler_obj = new(event.emitter) handler_method_name = Emittance::Action::HANDLER_METHOD_NAME - if handler_obj.respond_to? handler_method_name - handler_obj.send handler_method_name - end + handler_obj.send(handler_method_name) if handler_obj.respond_to?(handler_method_name) end end end + # rubocop:enable Metrics/MethodLength end end end