Class: Metanorma::Release::PublicationSource

Inherits:
Object
  • Object
show all
Defined in:
lib/metanorma/release/publication.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(owner:, repo:, tag:, url:, date:) ⇒ PublicationSource

Returns a new instance of PublicationSource.



40
41
42
43
44
45
46
47
# File 'lib/metanorma/release/publication.rb', line 40

def initialize(owner:, repo:, tag:, url:, date:)
  @owner = owner
  @repo = repo
  @tag = tag
  @url = url
  @date = date
  freeze
end

Instance Attribute Details

#dateObject (readonly)

Returns the value of attribute date.



38
39
40
# File 'lib/metanorma/release/publication.rb', line 38

def date
  @date
end

#ownerObject (readonly)

Returns the value of attribute owner.



38
39
40
# File 'lib/metanorma/release/publication.rb', line 38

def owner
  @owner
end

#repoObject (readonly)

Returns the value of attribute repo.



38
39
40
# File 'lib/metanorma/release/publication.rb', line 38

def repo
  @repo
end

#tagObject (readonly)

Returns the value of attribute tag.



38
39
40
# File 'lib/metanorma/release/publication.rb', line 38

def tag
  @tag
end

#urlObject (readonly)

Returns the value of attribute url.



38
39
40
# File 'lib/metanorma/release/publication.rb', line 38

def url
  @url
end

Instance Method Details

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/metanorma/release/publication.rb', line 53

def eql?(other)
  other.is_a?(self.class) && owner == other.owner && repo == other.repo && tag == other.tag
end

#hashObject



57
58
59
# File 'lib/metanorma/release/publication.rb', line 57

def hash
  [owner, repo, tag].hash
end

#repo_keyObject



49
50
51
# File 'lib/metanorma/release/publication.rb', line 49

def repo_key
  "#{owner}/#{repo}"
end

#to_hObject



61
62
63
64
# File 'lib/metanorma/release/publication.rb', line 61

def to_h
  { "owner" => owner, "repo" => repo, "tag" => tag,
    "releaseUrl" => url, "releaseDate" => date }
end