module Scanny
  class Issue
    attr_reader :file, :line, :impact, :message, :cwe

    def initialize(file, line, impact, message, cwe = nil)
      @file, @line, @impact, @message, @cwe = file, line, impact, message, cwe
    end

    def ==(other)
      other.instance_of?(self.class) &&
        @file == other.file &&
        @line == other.line &&
        @impact == other.impact &&
        @message == other.message &&
        @cwe == other.cwe
    end

    def to_s
      cwe_suffix = if @cwe
        " (" + @cwe.to_a.map { |cwe| "CWE-#{cwe}" }.join(", ") + ")"
      else
        ""
      end

      "[#{@impact}] #{@file}:#{@line}: #{@message}#{cwe_suffix}"
    end
  end
end

module Scanny
  class Issue
    attr_reader :file, :line, :impact, :message, :cwe

    def initialize(file, line, impact, message, cwe = nil)
      @file, @line, @impact, @message, @cwe = file, line, impact, message, cwe
    end

    def ==(other)
      other.instance_of?(self.class) &&
        @file == other.file &&
        @line == other.line &&
        @impact == other.impact &&
        @message == other.message &&
        @cwe == other.cwe
    end

    def to_s
      cwe_suffix = if @cwe
        " (" + Array(@cwe).map { |cwe| "CWE-#{cwe}" }.join(", ") + ")"
      else
        ""
      end

      "[#{@impact}] #{@file}:#{@line}: #{@message}#{cwe_suffix}"
    end
  end
end

Fix specs for ruby 1.9
Fix specs for ruby 1.9

Force to create Array from @cwe
