lib/ldp/resource/binary_source.rb in ldp-1.0.0 vs lib/ldp/resource/binary_source.rb in ldp-1.0.1
- old
+ new
@@ -1,19 +1,24 @@
module Ldp
class Resource::BinarySource < Ldp::Resource
attr_accessor :content
+ # @param client [Ldp::Client]
+ # @param subject [String] the URI for the resource
+ # @param content_or_response [String,Ldp::Response]
+ # @param base_path [String] ('')
def initialize client, subject, content_or_response = nil, base_path = ''
super
case content_or_response
- when Faraday::Response
+ when Ldp::Response
else
@content = content_or_response
end
end
+ # @return [Ldp::Response]
def content
@content ||= get.body
end
def described_by
@@ -23,10 +28,10 @@
end
# Override inspect so that `content` is never shown. It is typically too big to be helpful
def inspect
string = "#<#{self.class.name}:#{self.object_id} "
- fields = [:subject].map{|field| "#{field}=\"#{self.send(field)}\""}
+ fields = [:subject].map { |field| "#{field}=\"#{self.send(field)}\"" }
string << fields.join(", ") << ">"
end
protected