Module: ActiveFedora::FedoraAttributes::ClassMethods
- Defined in:
- lib/active_fedora/fedora_attributes.rb
Instance Method Summary collapse
-
#resource_class ⇒ Object
We make a unique class, because properties belong to a class.
-
#resource_class_factory ⇒ Object
Allow inherited classes to override what class is used for triples ORM.
Instance Method Details
#resource_class ⇒ Object
We make a unique class, because properties belong to a class. This keeps properties from different objects separate. Since the copy of properties can only happen once, we don’t want to invoke it until all properties have been defined.
58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/active_fedora/fedora_attributes.rb', line 58 def resource_class @generated_resource_class ||= begin klass = const_set(:GeneratedResourceSchema, Class.new(resource_class_factory)) klass.configure klass.properties.merge(properties).each do |_property, config| klass.property(config.term, predicate: config.predicate, class_name: config.class_name) end klass end end |
#resource_class_factory ⇒ Object
Allow inherited classes to override what class is used for triples ORM.
72 73 74 |
# File 'lib/active_fedora/fedora_attributes.rb', line 72 def resource_class_factory ActiveTriples::Resource end |