Sha256: c26d613ed6a1af627ebc4ab55fd2366df9814fe9416f6c983b72df28866a4e9b
Contents?: true
Size: 1.01 KB
Versions: 98
Compression:
Stored size: 1.01 KB
Contents
# frozen_string_literal: true require "pathname" module Dependabot class DependencyFile attr_accessor :name, :content, :directory, :type, :support_file def initialize(name:, content:, directory: "/", type: "file", support_file: false) @name = name @content = content @directory = clean_directory(directory) @type = type @support_file = support_file end def to_h { "name" => name, "content" => content, "directory" => directory, "type" => type } end def path Pathname.new(File.join(directory, name)).cleanpath.to_path end def ==(other) other.instance_of?(self.class) && to_h == other.to_h end def hash to_h.hash end def eql?(other) self.==(other) end def support_file? @support_file end private def clean_directory(directory) # Directory should always start with a `/` directory.sub(%r{^/*}, "/") end end end
Version data entries
98 entries across 98 versions & 1 rubygems