Sha256: 9dd4166d79ffa7c24421c53b69d9a34a85d12d9e627afee4f712acc83790215c

Contents?: true

Size: 1.11 KB

Versions: 40

Compression:

Stored size: 1.11 KB

Contents

require 'pact_broker/api/pact_broker_urls'
require 'pact_broker/ui/helpers/url_helper'
require 'pact_broker/date_helper'

module PactBroker
  module UI
    module ViewDomain
      class MatrixTag

        include PactBroker::Api::PactBrokerUrls

        def initialize params
          @params = params
          @name = params[:name]
          @version_number = params[:version_number]
          @created_at = params[:created_at]
          @latest = !!params[:latest]
        end

        def name
          @params[:name]
        end

        def tooltip
          if @latest
            "Version #{@version_number} is the latest version with tag #{@name}. Tag created #{relative_date(@created_at)}."
          else
            "Tag created #{relative_date(@created_at)}."
          end
        end

        def url
          hal_browser_url("/pacticipants/#{ERB::Util.url_encode(@params[:pacticipant_name])}/versions/#{@params[:version_number]}/tags/#{@params[:name]}")
        end

        def relative_date date
          DateHelper.distance_of_time_in_words(date, DateTime.now) + " ago"
        end
      end
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
pact_broker-2.40.0 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.39.0 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.38.1 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.38.0 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.37.0 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.36.1 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.36.0 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.35.0 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.34.0 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.33.0 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.32.0 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.31.0 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.30.0 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.29.0 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.27.6 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.27.5 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.27.4 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.27.3 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.27.2 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.27.0 lib/pact_broker/ui/view_models/matrix_tag.rb