Class: ActiveFedora::Rdf::List::ListResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/active_fedora/rdf/list.rb

Overview

This class is the graph/Resource that backs the List and supplies integration with the rest of ActiveFedora::Rdf

Instance Attribute Summary collapse

Attributes inherited from Resource

#parent

Attributes included from Properties

#config

Instance Method Summary collapse

Methods inherited from Resource

#base_uri, #destroy, #destroy_child, #fetch, #fields, #final_parent, from_uri, #get_term, #get_values, #graph, #initialize, #mark_for_destruction, #marked_for_destruction?, #new_record?, #node?, #persist!, #persisted?, #rdf_label, #rdf_subject, #reload, #set_subject!, #set_value, #solrize, #to_term, #type, #type=, type_registry, #writable?

Methods included from Configurable

#base_uri, #configure, #rdf_label, #rdf_type, #repository, #transform_type, #type

Methods included from Properties

#config_for_term_or_uri, #fields, #map_predicates, #property

Constructor Details

This class inherits a constructor from ActiveFedora::Rdf::Resource

Instance Attribute Details

#listObject

Returns the value of attribute list.



93
94
95
# File 'lib/active_fedora/rdf/list.rb', line 93

def list
  @list
end

Instance Method Details

#attributes=(values) ⇒ Object

Raises:

  • (ArgumentError)


99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/active_fedora/rdf/list.rb', line 99

def attributes=(values)
  raise ArgumentError, "values must be a Hash, you provided #{values.class}" unless values.kind_of? Hash
  values.with_indifferent_access.each do |key, value|
    if self.singleton_class.properties.keys.map{ |k| "#{k}_attributes"}.include?(key)
      klass = properties[key[0..-12]]['class_name']
      klass = ActiveFedora.class_from_string(klass, final_parent.class) if klass.is_a? String
      value.is_a?(Hash) ? attributes_hash_to_list(values[key], klass) : attributes_to_list(value, klass)
      values.delete key
    end
  end
  persist!
  super
end