class PactBroker::UI::ViewDomain::MatrixTag

Attributes

name[R]
pacticipant_name[R]
version_number[R]

Public Class Methods

new(params) click to toggle source
# File lib/pact_broker/ui/view_models/matrix_tag.rb, line 13
def initialize params
  @name = params[:name]
  @pacticipant_name = params[:pacticipant_name]
  @version_number = params[:version_number]
  @created_at = params[:created_at]
  @latest = !!params[:latest]
end

Public Instance Methods

relative_date(date) click to toggle source
# File lib/pact_broker/ui/view_models/matrix_tag.rb, line 33
def relative_date date
  DateHelper.distance_of_time_in_words(date, DateTime.now) + " ago"
end
tooltip() click to toggle source
# File lib/pact_broker/ui/view_models/matrix_tag.rb, line 21
def tooltip
  if @latest
    "This is the latest version of #{pacticipant_name} with tag \"#{@name}\". Tag created #{relative_date(@created_at)}."
  else
    "Tag created #{relative_date(@created_at)}. A more recent version of #{pacticipant_name} with tag \"#{name}\" exists."
  end
end
url() click to toggle source
# File lib/pact_broker/ui/view_models/matrix_tag.rb, line 29
def url
  hal_browser_url("/pacticipants/#{ERB::Util.url_encode(pacticipant_name)}/versions/#{ERB::Util.url_encode(version_number)}/tags/#{ERB::Util.url_encode(name)}")
end