Ruby - Strings - Methods II

  • + 0 comments
    def mask_article(string, arr)
        arr.map do |word|
            string.gsub!(word, strike(word)) if string.include? word
        end
        string
    end
    
    public def strike(string)
        "<strike>#{string}</strike>"
    end