Sha256: a57b56eede45df4ab8847856d531a9db04f27a99ccc3bb115236b275b9a89a5c

Contents?: true

Size: 550 Bytes

Versions: 16

Compression:

Stored size: 550 Bytes

Contents

module Ldp
  class Container::Basic < Container
    def members
      return enum_for(:members) unless block_given?
      contains.each { |k, x| yield x }
    end

    def contains
      @contains ||= Hash[get.graph.query(predicate: Ldp.contains).map do |x| 
        [x.object, Ldp::Resource::RdfSource.new(client, x.object, contained_graph(x.object))]
      end]
    end
    
    private
    def contained_graph subject
      g = RDF::Graph.new
      get.graph.query(subject: subject) do |stmt|
        g << stmt
      end
      g
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
ldp-0.4.1 lib/ldp/container/basic.rb
ldp-0.4.0 lib/ldp/container/basic.rb
ldp-0.3.1 lib/ldp/container/basic.rb
ldp-0.3.0 lib/ldp/container/basic.rb
ldp-0.2.3 lib/ldp/container/basic.rb
ldp-0.2.2 lib/ldp/container/basic.rb
ldp-0.2.1 lib/ldp/container/basic.rb
ldp-0.2.0 lib/ldp/container/basic.rb
ldp-0.1.0 lib/ldp/container/basic.rb
ldp-0.0.10 lib/ldp/container/basic.rb
ldp-0.0.9 lib/ldp/container/basic.rb
ldp-0.0.8 lib/ldp/container/basic.rb
ldp-0.0.7 lib/ldp/container/basic.rb
ldp-0.0.6 lib/ldp/container/basic.rb
ldp-0.0.5 lib/ldp/container/basic.rb
ldp-0.0.4 lib/ldp/container/basic.rb