Class: CreateGithubRelease::Change

Inherits:
Object
  • Object
show all
Defined in:
lib/create_github_release/change.rb

Overview

The release information needed to generate a changelog

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sha, subject) ⇒ Change

Create a new release object

Examples:

sha = 'f5e69d6'
subject = 'Release v1.0.0'

change = CreateGithubRelease::Change.new(sha, subject)
change.sha # => 'f5e69d6'
change.subject # => 'Release v1.0.0'

Parameters:

  • sha (String)

    The sha of the change

  • subject (String)

    The subject (aka description) of the change



22
23
24
25
# File 'lib/create_github_release/change.rb', line 22

def initialize(sha, subject)
  @sha = sha
  @subject = subject
end

Instance Attribute Details

#shaString (readonly)

The commit sha of the change

Examples:

sha = 'f5e69d6'
subject = 'Release v1.0.0'

change = CreateGithubRelease::Change.new(sha, subject))
change.sha # => 'f5e69d6'

Returns:

  • (String)

    The commit sha of the change



37
38
39
# File 'lib/create_github_release/change.rb', line 37

def sha
  @sha
end

#subjectString (readonly)

The subject (aka description) of the change

Examples:

sha = 'f5e69d6'
subject = 'Release v1.0.0'

change = CreateGithubRelease::Change.new(sha, subject))
change.subject # => 'Release v1.0.0'

Returns:

  • (String)

    The subject (aka description) of the change



49
50
51
# File 'lib/create_github_release/change.rb', line 49

def subject
  @subject
end

Instance Method Details

#==(other) ⇒ Boolean

Compare two changes to see if they refer to the same change

Two changes are equal if their sha and subject attributes are equal.

Examples:

change1 = CreateGithubRelease::Change.new('f5e69d6', 'Release v1.0.0')
change2 = CreateGithubRelease::Change.new('f5e69d6', 'Release v1.0.0')
change3 = CreateGithubRelease::Change.new('9387be0', 'Release v1.0.0')
change4 = CreateGithubRelease::Change.new('f5e69d6', 'Release v2.0.0')
change5 = CreateGithubRelease::Change.new('9387be0', 'Release v2.0.0')
change1 == change2 #=> true
change1 == change3 #=> false
change1 == change4 #=> false
change1 == change5 #=> false

Parameters:

Returns:

  • (Boolean)

    true if the two changes are equal, false otherwise



69
70
71
# File 'lib/create_github_release/change.rb', line 69

def ==(other)
  self.class == other.class && sha == other.sha && subject == other.subject
end