Sha256: caf5e9bf945ca7f5213bb5ed444b4a9deb0d71921716707e9d492bf55b83c1c9

Contents?: true

Size: 862 Bytes

Versions: 13

Compression:

Stored size: 862 Bytes

Contents

# frozen_string_literal: true

require_relative '../checks'

module Github
  # A GitHub file.
  class File
    include Checks

    attr_reader :full_path, :path, :tree_sha, :content, :github_url

    def initialize(owner:, repo:, ref:, tree_sha:, path:, content:)
      check_non_empty_string(owner: owner, repo: repo, ref: ref, path: path, tree_sha: tree_sha)
      @full_path = "#{owner}/#{repo}/#{ref}/#{path}"
      @path = path
      @tree_sha = tree_sha
      @content = check_is_a(content: [String, content])
      @github_url = "https://github.com/#{owner}/#{repo}/blob/#{ref}/#{path}"
    end

    def ==(other)
      self.class == other.class &&
        @full_path == other.full_path &&
        @path == other.path &&
        @tree_sha == other.tree_sha &&
        @content == other.content &&
        @github_url == other.github_url
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
sqlui-0.1.84 app/github/file.rb
sqlui-0.1.83 app/github/file.rb
sqlui-0.1.82 app/github/file.rb
sqlui-0.1.81 app/github/file.rb
sqlui-0.1.80 app/github/file.rb
sqlui-0.1.79 app/github/file.rb
sqlui-0.1.78 app/github/file.rb
sqlui-0.1.77 app/github/file.rb
sqlui-0.1.76 app/github/file.rb
sqlui-0.1.75 app/github/file.rb
sqlui-0.1.74 app/github/file.rb
sqlui-0.1.73 app/github/file.rb
sqlui-0.1.72 app/github/file.rb