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.



33
34
35
36
37
38
39
40
# File 'lib/metanorma/release/publication.rb', line 33

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.



31
32
33
# File 'lib/metanorma/release/publication.rb', line 31

def date
  @date
end

#ownerObject (readonly)

Returns the value of attribute owner.



31
32
33
# File 'lib/metanorma/release/publication.rb', line 31

def owner
  @owner
end

#repoObject (readonly)

Returns the value of attribute repo.



31
32
33
# File 'lib/metanorma/release/publication.rb', line 31

def repo
  @repo
end

#tagObject (readonly)

Returns the value of attribute tag.



31
32
33
# File 'lib/metanorma/release/publication.rb', line 31

def tag
  @tag
end

#urlObject (readonly)

Returns the value of attribute url.



31
32
33
# File 'lib/metanorma/release/publication.rb', line 31

def url
  @url
end

Instance Method Details

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/metanorma/release/publication.rb', line 46

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

#hashObject



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

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

#repo_keyObject



42
43
44
# File 'lib/metanorma/release/publication.rb', line 42

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

#to_hObject



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

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