Class: Github::File
Overview
A GitHub file.
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#full_path ⇒ Object
readonly
Returns the value of attribute full_path.
-
#github_url ⇒ Object
readonly
Returns the value of attribute github_url.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#tree_sha ⇒ Object
readonly
Returns the value of attribute tree_sha.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(owner:, repo:, ref:, tree_sha:, path:, content:) ⇒ File
constructor
A new instance of File.
Methods included from Checks
#check_boolean, #check_enumerable_of, #check_is_a, #check_non_empty_string, #check_non_nil, #check_positive_integer
Constructor Details
#initialize(owner:, repo:, ref:, tree_sha:, path:, content:) ⇒ File
Returns a new instance of File.
12 13 14 15 16 17 18 19 |
# File 'app/github/file.rb', line 12 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 |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
10 11 12 |
# File 'app/github/file.rb', line 10 def content @content end |
#full_path ⇒ Object (readonly)
Returns the value of attribute full_path.
10 11 12 |
# File 'app/github/file.rb', line 10 def full_path @full_path end |
#github_url ⇒ Object (readonly)
Returns the value of attribute github_url.
10 11 12 |
# File 'app/github/file.rb', line 10 def github_url @github_url end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
10 11 12 |
# File 'app/github/file.rb', line 10 def path @path end |
#tree_sha ⇒ Object (readonly)
Returns the value of attribute tree_sha.
10 11 12 |
# File 'app/github/file.rb', line 10 def tree_sha @tree_sha end |
Instance Method Details
#==(other) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'app/github/file.rb', line 21 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 |