Class: Dependabot::GitRef

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/git_ref.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, commit_sha:, tag_sha: nil, ref_sha: nil, ref_type: nil) ⇒ GitRef

Returns a new instance of GitRef.



35
36
37
38
39
40
41
# File 'lib/dependabot/git_ref.rb', line 35

def initialize(name:, commit_sha:, tag_sha: nil, ref_sha: nil, ref_type: nil)
  @name = name
  @commit_sha = commit_sha
  @ref_sha = ref_sha
  @tag_sha = tag_sha
  @ref_type = ref_type
end

Instance Attribute Details

#commit_shaObject

Returns the value of attribute commit_sha.



14
15
16
# File 'lib/dependabot/git_ref.rb', line 14

def commit_sha
  @commit_sha
end

#nameObject

Returns the value of attribute name.



11
12
13
# File 'lib/dependabot/git_ref.rb', line 11

def name
  @name
end

#ref_shaObject (readonly)

Returns the value of attribute ref_sha.



20
21
22
# File 'lib/dependabot/git_ref.rb', line 20

def ref_sha
  @ref_sha
end

#ref_typeObject (readonly)

Returns the value of attribute ref_type.



23
24
25
# File 'lib/dependabot/git_ref.rb', line 23

def ref_type
  @ref_type
end

#tag_shaObject (readonly)

Returns the value of attribute tag_sha.



17
18
19
# File 'lib/dependabot/git_ref.rb', line 17

def tag_sha
  @tag_sha
end

Instance Method Details

#==(other) ⇒ Object



44
45
46
47
48
49
50
51
# File 'lib/dependabot/git_ref.rb', line 44

def ==(other)
  case other
  when GitRef
    to_h == other.to_h
  else
    false
  end
end

#to_hObject



54
55
56
57
58
59
60
61
62
# File 'lib/dependabot/git_ref.rb', line 54

def to_h
  {
    name: name,
    commit_sha: commit_sha,
    tag_sha: tag_sha,
    ref_sha: ref_sha,
    ref_type: ref_type
  }.compact
end