class Ldp::Resource::BinarySource

Attributes

content[RW]

Public Class Methods

new(client, subject, content_or_response = nil, base_path = '') click to toggle source

@param client [Ldp::Client] @param subject [String] the URI for the resource @param content_or_response [String,Ldp::Response] @param base_path [String] (”)

Calls superclass method Ldp::Resource::new
# File lib/ldp/resource/binary_source.rb, line 9
def initialize client, subject, content_or_response = nil, base_path = ''
  super

  case content_or_response
  when Ldp::Response
  else
    @content = content_or_response
  end
end

Public Instance Methods

described_by() click to toggle source
# File lib/ldp/resource/binary_source.rb, line 24
def described_by
  described_by = Array(head.links["describedby"]).first

  client.find_or_initialize described_by if described_by
end
inspect() click to toggle source

Override inspect so that ‘content` is never shown. It is typically too big to be helpful

# File lib/ldp/resource/binary_source.rb, line 31
def inspect
  string = "#<#{self.class.name}:#{self.object_id} "
  fields = [:subject].map { |field| "#{field}=\"#{self.send(field)}\"" }
  string << fields.join(", ") << ">"
end

Protected Instance Methods

interaction_model() click to toggle source
# File lib/ldp/resource/binary_source.rb, line 39
def interaction_model
  RDF::Vocab::LDP.NonRDFSource
end