class Metamatter::Readme
Attributes
repository[RW]
Public Class Methods
new(repository)
click to toggle source
# File lib/metamatter/readme.rb, line 9 def initialize(repository) @repository = repository end
Public Instance Methods
contents()
click to toggle source
# File lib/metamatter/readme.rb, line 13 def contents contents = github_response return Base64.decode64(contents.content) end
doi()
click to toggle source
Find the Zenodo DOI if it’s there Returns a DOI URL 10.5281/zenodo.9789 or nil
# File lib/metamatter/readme.rb, line 24 def doi if has_zenodo_badge? match = contents.match(/\d{2}.\d{4}\/zenodo.\d*/)[0] return match else return nil end end
github_response()
click to toggle source
# File lib/metamatter/readme.rb, line 33 def github_response @github_response ||= client.readme(repository.name_with_owner) end
has_zenodo_badge?()
click to toggle source
# File lib/metamatter/readme.rb, line 18 def has_zenodo_badge? contents.include?('zenodo.org/badge') end