Class: Ldp::Container::Direct

Inherits:
Basic show all
Defined in:
lib/ldp/container/direct.rb

Direct Known Subclasses

Indirect

Instance Attribute Summary

Attributes inherited from Resource

#client, #content, #subject

Instance Method Summary collapse

Methods inherited from Basic

#contains

Methods inherited from Ldp::Container

#add, new_from_response

Methods inherited from Resource::RdfSource

#build_empty_graph, #content, #create, #graph, #graph_class, #initialize

Methods inherited from Resource

#create, #current?, #delete, #get, #head, #initialize, #new?, #reload, #retrieved_content?, #save, #subject_uri, #update, #update_cached_get

Constructor Details

This class inherits a constructor from Ldp::Resource::RdfSource

Instance Method Details

#member_relationObject



11
12
13
# File 'lib/ldp/container/direct.rb', line 11

def member_relation
  graph.first_object(predicate: Ldp.hasMemberRelation) || Ldp.member
end

#membersObject



3
4
5
6
7
8
9
# File 'lib/ldp/container/direct.rb', line 3

def members
  return enum_for(:members) unless block_given?
  
  get.graph.query(subject: subject, predicate: member_relation).map do |x| 
    yield contains[x.object] || Ldp::Resource::RdfSource.new(client, x.object)
  end
end