module RenderCow module RenderCowPatch def render(options = {}, args = {}) options[:plain] = cowspeach(options).then { RenderCow.moo(_1, character) } if character?(options) super end private def character(options = {}) options[:cow] = options.delete(:cowsay) if options.key?(:cowsay) @character ||= options.detect do |key| RenderCow.characters.find(key) end&.first end def character?(options) return unless options.is_a?(Hash) character(options).present? end def cowspeach(options = {}) options[character] end end end