Class: Ldp::Resource::BinarySource
- Inherits:
-
Ldp::Resource
- Object
- Ldp::Resource
- Ldp::Resource::BinarySource
- Defined in:
- lib/ldp/resource/binary_source.rb
Instance Attribute Summary collapse
Attributes inherited from Ldp::Resource
Instance Method Summary collapse
- #described_by ⇒ Object
-
#initialize(client, subject, content_or_response = nil, base_path = '') ⇒ BinarySource
constructor
A new instance of BinarySource.
-
#inspect ⇒ Object
Override inspect so that ‘content` is never shown.
Methods inherited from Ldp::Resource
#create, #current?, #delete, for, #get, #head, #new?, #reload, #retrieved_content?, #save, #subject_uri, #update, #update_cached_get
Constructor Details
#initialize(client, subject, content_or_response = nil, base_path = '') ⇒ BinarySource
Returns a new instance of BinarySource.
9 10 11 12 13 14 15 16 17 |
# 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 |
Instance Attribute Details
#content ⇒ Ldp::Response
20 21 22 |
# File 'lib/ldp/resource/binary_source.rb', line 20 def content @content end |
Instance Method Details
#described_by ⇒ Object
24 25 26 27 28 |
# 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 ⇒ Object
Override inspect so that ‘content` is never shown. It is typically too big to be helpful
31 32 33 34 35 |
# 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 |