Module: Tripod::EmbeddedResource

Extended by:
ActiveSupport::Concern
Includes:
ActiveModel::Validations, Attributes, Dirty, Fields, Predicates, RdfType, Validations
Defined in:
lib/tripod/embedded_resource.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from RdfType

#set_rdf_type

Methods included from Dirty

#attribute_change, #attribute_changed?, #attribute_will_change!, #changed, #changed_attributes, #changes, #post_persist

Methods included from Fields

#fields, included

Methods included from Attributes

#read_attribute, #write_attribute

Methods included from Predicates

#append_to_predicate, #predicates, #read_predicate, #remove_predicate, #write_predicate

Instance Attribute Details

#uriObject (readonly)

Returns the value of attribute uri.



13
14
15
# File 'lib/tripod/embedded_resource.rb', line 13

def uri
  @uri
end

Instance Method Details

#==(resource) ⇒ Object



25
26
27
# File 'lib/tripod/embedded_resource.rb', line 25

def ==(resource)
  (@uri == resource.uri)
end

#initialize(opts = {}) ⇒ Object



15
16
17
18
19
# File 'lib/tripod/embedded_resource.rb', line 15

def initialize(opts={})
  @uri = opts.fetch(:node, RDF::Node.new) # use a blank node for the URI
  @repository = opts.fetch(:repository, RDF::Repository.new)
  set_rdf_type
end

#to_statementsObject



21
22
23
# File 'lib/tripod/embedded_resource.rb', line 21

def to_statements
  @repository.statements
end