Class: Fedora::BaseObject

Inherits:
Object
  • Object
show all
Defined in:
lib/fedora/base.rb

Direct Known Subclasses

Datastream, FedoraObject

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ BaseObject

Returns a new instance of BaseObject.

Parameters:

  • attrs (Hash) (defaults to: {})

    object attributes



23
24
25
26
27
28
29
# File 'lib/fedora/base.rb', line 23

def initialize(attrs = {})
  @new_object = true
  @attributes = attrs || {}
  @errors = []
  @blob = attributes.delete(:blob)
  @repository = Fedora::Repository.instance
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



18
19
20
# File 'lib/fedora/base.rb', line 18

def attributes
  @attributes
end

#blobObject

Returns the value of attribute blob.



18
19
20
# File 'lib/fedora/base.rb', line 18

def blob
  @blob
end

#errorsObject (readonly)

Returns the value of attribute errors.



19
20
21
# File 'lib/fedora/base.rb', line 19

def errors
  @errors
end

#new_object=(value) ⇒ Object (writeonly)

Sets the attribute new_object

Parameters:

  • value

    the value to set the attribute new_object to.



20
21
22
# File 'lib/fedora/base.rb', line 20

def new_object=(value)
  @new_object = value
end

#uriObject

Returns the value of attribute uri.



18
19
20
# File 'lib/fedora/base.rb', line 18

def uri
  @uri
end

Instance Method Details

#[](key) ⇒ Object



31
32
33
# File 'lib/fedora/base.rb', line 31

def [](key)
  @attributes[key]
end

#new_object?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/fedora/base.rb', line 35

def new_object?
  @new_object
end