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

samvera / ldp / 41b5a6ca-fe68-4193-a2c9-87e512bf0788

19 Aug 2024 06:45PM UTC coverage: 86.165%. Remained the same
41b5a6ca-fe68-4193-a2c9-87e512bf0788

push

circleci

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

492 of 571 relevant lines covered (86.16%)

51.82 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
21✔
2
  class Resource::BinarySource < Ldp::Resource
21✔
3
    attr_accessor :content
21✔
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 = ''
21✔
10
      super
36✔
11

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

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

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

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

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

37
    protected
21✔
38

39
    def interaction_model
21✔
40
      RDF::Vocab::LDP.NonRDFSource
8✔
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