app/github/file.rb in sqlui-0.1.71 vs app/github/file.rb in sqlui-0.1.72

- old
+ new

@@ -5,15 +5,26 @@ module Github # A GitHub file. class File include Checks - attr_reader :display_path, :content, :github_url + attr_reader :full_path, :path, :tree_sha, :content, :github_url - def initialize(owner:, repo:, branch:, path:, content:) - check_non_empty_string(owner: owner, repo: repo, branch: branch, path: path) + 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]) - @display_path = "#{owner}/#{repo}/#{branch}/#{path}" - @github_url = "https://github.com/#{owner}/#{repo}/blob/#{branch}/#{path}" + @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