• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pulibrary / pdc_describe / cace366a-ffad-45f1-9b60-678e607fa527

14 May 2024 02:21PM UTC coverage: 60.862% (-35.0%) from 95.908%
cace366a-ffad-45f1-9b60-678e607fa527

push

circleci

jrgriffiniii
wip

1 of 3 new or added lines in 2 files covered. (33.33%)

1194 existing lines in 57 files now uncovered.

2076 of 3411 relevant lines covered (60.86%)

22.71 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

86.96
/app/presenters/work_presenter.rb
1
# frozen_string_literal: true
2
class WorkPresenter
1✔
3
  attr_reader :work
1✔
4

5
  delegate :resource, to: :work
1✔
6

7
  def initialize(work:)
1✔
8
    @work = work
18✔
9
  end
10

11
  def description
1✔
12
    value = resource.description
11✔
13
    return if value.nil?
11✔
14
    Rinku.auto_link(value, :all, 'target="_blank"')
11✔
15
  end
16

17
  def related_objects_link_list
1✔
18
    ro = resource.related_objects
7✔
19
    ro.map { |a| format_related_object_links(a) }
21✔
20
  end
21

22
  # relation_type, identifier, link
23
  def format_related_object_links(related_object)
1✔
24
    rol = RelatedObjectLink.new
14✔
25
    rol.identifier = related_object.related_identifier
14✔
26
    rol.relation_type = related_object.relation_type
14✔
27
    rol.link = format_link(related_object.related_identifier, related_object.related_identifier_type)
14✔
28
    rol
14✔
29
  end
30

31
  # Turn an identifier into a link. This will vary for different kinds of related objects.
32
  # A DOI URL is not the same as an arXiv URL, for example.
33
  # For now, only format links for DOI and arXiv identifiers
34
  def format_link(id, id_type)
1✔
35
    return id if id.starts_with?("http")
14✔
UNCOV
36
    return "https://doi.org/#{id}" if id_type == "DOI"
×
UNCOV
37
    return "https://arxiv.org/abs/#{id}" if id_type == "arXiv"
×
UNCOV
38
    ""
×
39
  end
40
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc