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

samvera / hydra-pcdm / 65136fe3-7459-42d0-8dcf-fad3664e0817

21 Apr 2023 06:52PM UTC coverage: 72.072% (-27.9%) from 100.0%
65136fe3-7459-42d0-8dcf-fad3664e0817

push

circleci

web-flow
Release 1.3.0 (#299)

160 of 222 relevant lines covered (72.07%)

8.92 hits per line

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

69.57
/lib/hydra/pcdm/models/concerns/collection_behavior.rb
1
module Hydra::PCDM
12✔
2
  ##
3
  # Implements behavior for PCDM collections.
4
  #
5
  # The behavior is summarized as:
6
  #   1) Hydra::PCDM::Collection can aggregate (pcdm:hasMember)  Hydra::PCDM::Collection (no infinite loop, e.g., A -> B -> C -> A)
7
  #   2) Hydra::PCDM::Collection can aggregate (pcdm:hasMember)  Hydra::PCDM::Object
8
  #   3) Hydra::PCDM::Collection can aggregate (ore:aggregates) Hydra::PCDM::Object  (Object related to the Collection)
9
  #   4) Hydra::PCDM::Collection can NOT aggregate non-PCDM object
10
  #   5) Hydra::PCDM::Collection can NOT contain (pcdm:hasFile)  Hydra::PCDM::File
11
  #   6) Hydra::PCDM::Collection can have descriptive metadata
12
  #   7) Hydra::PCDM::Collection can have access metadata
13
  #
14
  module CollectionBehavior
12✔
15
    extend ActiveSupport::Concern
12✔
16

17
    included do
12✔
18
      type Vocab::PCDMTerms.Collection
12✔
19
      include ::Hydra::PCDM::PcdmBehavior
12✔
20
    end
21

22
    ##
23
    # @see ActiveSupport::Concern
24
    module ClassMethods
12✔
25
      ##
26
      # @return [Class] the indexer class
27
      def indexer
12✔
28
        Hydra::PCDM::CollectionIndexer
×
29
      end
30

31
      ##
32
      # @return [Class] the validator class
33
      def type_validator
12✔
34
        Validators::PCDMCollectionValidator
12✔
35
      end
36
    end
37

38
    ##
39
    # @return [Enumerable<PCDM::CollectionBehavior>]
40
    def collections
12✔
41
      members.select(&:pcdm_collection?)
×
42
    end
43

44
    ##
45
    # @return [Enumerable<String>]
46
    def collection_ids
12✔
47
      members.select(&:pcdm_collection?).map(&:id)
×
48
    end
49

50
    ##
51
    # @return [Enumerable<PCDM::CollectionBehavior>]
52
    def ordered_collections
12✔
53
      ordered_members.to_a.select(&:pcdm_collection?)
×
54
    end
55

56
    ##
57
    # @return [Enumerable<String>]
58
    def ordered_collection_ids
12✔
59
      ordered_collections.map(&:id)
×
60
    end
61

62
    ##
63
    # @return [Boolean] whether this instance is a PCDM Object.
64
    def pcdm_object?
12✔
65
      false
×
66
    end
67

68
    ##
69
    # @return [Boolean] whether this instance is a PCDM Collection.
70
    def pcdm_collection?
12✔
71
      true
×
72
    end
73
  end
74
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