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

samvera / ldp / 7aae4f98-f021-4aa3-ade3-5b1586e22f3d

19 Aug 2024 06:45PM UTC coverage: 86.165%. Remained the same
7aae4f98-f021-4aa3-ade3-5b1586e22f3d

push

circleci

web-flow
Test with latest ruby and rails versions (#156)

492 of 571 relevant lines covered (86.16%)

38.96 hits per line

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

100.0
/lib/ldp/resource/binary_source.rb
1
module Ldp
16✔
2
  class Resource::BinarySource < Ldp::Resource
16✔
3
    attr_accessor :content
16✔
4

5
    # @param client [Ldp::Client]
6
    # @param subject [String] the URI for the resource
7
    # @param content_or_response [String,Ldp::Response]
8
    # @param base_path [String] ('')
9
    def initialize client, subject, content_or_response = nil, base_path = ''
16✔
10
      super
27✔
11

12
      case content_or_response
27✔
13
      when Ldp::Response
14
      else
15
        @content = content_or_response
15✔
16
      end
17
    end
18

19
    # @return [Ldp::Response]
20
    def content
16✔
21
      @content ||= get.body
6✔
22
    end
23

24
    def described_by
16✔
25
      described_by = Array(head.links["describedby"]).first
6✔
26

27
      client.find_or_initialize described_by if described_by
6✔
28
    end
29

30
    # Override inspect so that `content` is never shown. It is typically too big to be helpful
31
    def inspect
16✔
32
      string = "#<#{self.class.name}:#{self.object_id} "
3✔
33
      fields = [:subject].map { |field| "#{field}=\"#{self.send(field)}\"" }
6✔
34
      string << fields.join(", ") << ">"
3✔
35
    end
36

37
    protected
16✔
38

39
    def interaction_model
16✔
40
      RDF::Vocab::LDP.NonRDFSource
6✔
41
    end
42
  end
43
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