Sha256: ecd90201157889e8e3f890531594422af2671edc2ca482ef683871bb5b108d8c

Contents?: true

Size: 1.97 KB

Versions: 2

Compression:

Stored size: 1.97 KB

Contents

#
# Copyright (c) 2013-2021 Hal Brodigan (postmodern.mod3 at gmail.com)
#
# bundler-audit is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# bundler-audit is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with bundler-audit.  If not, see <https://www.gnu.org/licenses/>.
#

require 'bundler/audit/results/result'

module Bundler
  module Audit
    module Results
      #
      # Represents an insecure gem source (ex: `git://...` or `http://...`).
      #
      class InsecureSource < Result

        # The insecure `git://` or `http://` URI.
        #
        # @return [URI::Generic, URI::HTTP]
        attr_reader :source

        #
        # Initializes the insecure source result.
        #
        # @param [URI::Generic, URI::HTTP] source
        #   The insecure `git://` or `http://` URI.
        #
        def initialize(source)
          @source = source
        end

        #
        # Compares the insecure source with another result.
        #
        # @param [Result] other
        #
        # @return [Boolean]
        #
        def ==(other)
          self.class == other.class && @source == other.source
        end

        #
        # Converts the insecure source result to a String.
        #
        # @return [String]
        #
        def to_s
          @source.to_s
        end

        #
        # Converts the insecure source into a Hash.
        #
        # @return [Hash{Symbol => Object}]
        #
        def to_h
          {
            type: :insecure_source,
            source: @source
          }
        end

      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bundler-audit-0.9.0.1 lib/bundler/audit/results/insecure_source.rb
bundler-audit-0.9.0 lib/bundler/audit/results/insecure_source.rb