lib/cureutils/logic/echo_logic.rb in cureutils-1.1.0 vs lib/cureutils/logic/echo_logic.rb in cureutils-1.1.1

- old
+ new

@@ -1,7 +1,7 @@ # frozen_string_literal: true -# coding: utf-8 + require 'cureutils/logic/base_logic' # Singleton class for cure echo class EchoLogic < BaseLogic module EchoMode @@ -37,13 +37,14 @@ @style_priority << style.to_sym if style end def print_results return 1 unless existing_precure? + precure = Cure.send(@cure_name.to_sym) if @message_mode == EchoMode::TRANSFORM - precure = original_transform(precure) + original_transform(precure) elsif @message_mode == EchoMode::ATTACK precure = original_transform(precure) precure.attack! end 0 @@ -51,10 +52,11 @@ private def original_transform(precure) return precure.transform! unless transformable?(precure) + chosen_style = @style_priority.find do |s| precure.transform_styles.include?(s) end if chosen_style precure.transform! chosen_style @@ -64,10 +66,12 @@ end end def transformable?(precure) return false if precure.transform_calls.nil? - return true if precure.respond_to?(:transform_styles) + + return true if precure.key?(:transform_styles) + false end def existing_precure? found_precure = Rubicure::Girl.config.find do |k, _v|