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

Parameters

attrs<Hash>

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.



16
17
18
# File 'lib/fedora/base.rb', line 16

def attributes
  @attributes
end

#blobObject

Returns the value of attribute blob.



16
17
18
# File 'lib/fedora/base.rb', line 16

def blob
  @blob
end

#errorsObject (readonly)

Returns the value of attribute errors.



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

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.



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

def new_object=(value)
  @new_object = value
end

#uriObject

Returns the value of attribute uri.



16
17
18
# File 'lib/fedora/base.rb', line 16

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