class LockDiff::Formatter::GithubMarkdown::DiffFormmater

Attributes

diff_info[R]

Public Class Methods

new(diff_info) click to toggle source
# File lib/lock_diff/formatter/github_markdown.rb, line 33
def initialize(diff_info)
  LockDiff.logger.info { diff_info.name }
  @diff_info = diff_info
end

Public Instance Methods

call() click to toggle source
# File lib/lock_diff/formatter/github_markdown.rb, line 38
def call
  text = []
  text << package
  text << repository
  text << status
  text << commits_text
  text << changelogs
  "| #{text.join(' | ')} |"
end

Private Instance Methods

changelogs() click to toggle source
# File lib/lock_diff/formatter/github_markdown.rb, line 80
def changelogs
  if diff_info.changelogs
    diff_info.changelogs.map do |changelog|
      "[#{changelog.name}](#{changelog.url})"
    end.join(" ")
  else
    ""
  end
end
commits_text() click to toggle source
# File lib/lock_diff/formatter/github_markdown.rb, line 72
def commits_text
  if diff_info.commits_url
    "[#{diff_info.commits_url_text}](#{diff_info.commits_url})"
  else
    diff_info.commits_url_text
  end
end
package() click to toggle source
# File lib/lock_diff/formatter/github_markdown.rb, line 56
def package
  if diff_info.package_url
    "[#{diff_info.name}](#{diff_info.package_url})"
  else
    diff_info.name
  end
end
repository() click to toggle source
# File lib/lock_diff/formatter/github_markdown.rb, line 64
def repository
  if diff_info.repository_url
    "[:octocat:](#{diff_info.repository_url})"
  else
    ''
  end
end
status() click to toggle source
# File lib/lock_diff/formatter/github_markdown.rb, line 52
def status
  diff_info.status_emoji
end