Method: Ldp::Resource::RdfSource#initialize

Defined in:
lib/ldp/resource/rdf_source.rb

#initialize(client, subject, graph_or_response = nil, base_path = '') ⇒ RdfSource

Returns a new instance of RdfSource.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/ldp/resource/rdf_source.rb', line 4

def initialize client, subject, graph_or_response = nil, base_path = ''
  super

  case graph_or_response
  when RDF::Enumerable
    @graph = graph_or_response
  when Ldp::Response
    # no-op
    nil
  when NilClass
    # no-op
    nil
  else
    raise ArgumentError, "Third argument to #{self.class}.new should be a RDF::Enumerable or a Ldp::Response. You provided #{graph_or_response.class}"
  end
end