Module: ActiveFedora::FedoraAttributes::ClassMethods

Defined in:
lib/active_fedora/fedora_attributes.rb

Instance Method Summary collapse

Instance Method Details

#resource_classObject

We make a unique class, because properties belong to a class. This keeps properties from different objects separate.


68
69
70
71
72
73
74
75
76
77
78
# File 'lib/active_fedora/fedora_attributes.rb', line 68

def resource_class
  @generated_resource_class ||= begin
      klass = self.const_set(:GeneratedResourceSchema, Class.new(ActiveTriples::Resource))
      klass.properties.merge(self.properties).each do |property, config|
        klass.property(config.term,
                       predicate: config.predicate,
                       class_name: config.class_name)
      end
      klass
  end
end