Module: FRBR::Manifestation
- Includes:
- Group1, Group3
- Defined in:
- lib/frbr/manifestation.rb
Instance Attribute Summary collapse
Attributes included from Group3
#related_subjects, #subject_of
Attributes included from Group1
#relationships
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Group3
#add_related_subject, #add_subject_of, check_frbr_validity, #remove_related_subject, #remove_subject_of
Methods included from Group1
check_frbr_validity, #related
Instance Attribute Details
#embodiment_of ⇒ Object
Also known as:
expression
Returns the value of attribute embodiment_of.
5
6
7
|
# File 'lib/frbr/manifestation.rb', line 5
def embodiment_of
@embodiment_of
end
|
#exemplars ⇒ Object
Also known as:
items
Returns the value of attribute exemplars.
5
6
7
|
# File 'lib/frbr/manifestation.rb', line 5
def exemplars
@exemplars
end
|
#producers ⇒ Object
Returns the value of attribute producers.
5
6
7
|
# File 'lib/frbr/manifestation.rb', line 5
def producers
@producers
end
|
Class Method Details
.valid_relationships ⇒ Object
83
84
85
|
# File 'lib/frbr/manifestation.rb', line 83
def self.valid_relationships
{:accompanied_by=>:accompanies, :described_in=>:describes, :contains=>:contained_in, :reproduction=>:reproduction_of, :related=>:related}
end
|
Instance Method Details
#add_exemplar(item) ⇒ Object
Also known as:
add_item
40
41
42
43
44
45
|
# File 'lib/frbr/manifestation.rb', line 40
def add_exemplar(item)
raise ArgumentError, "Exemplar must an item" unless item.is_a?(FRBR::Item)
@exemplars ||= []
@exemplars << item unless @exemplars.index(item)
item.is_exemplar_of(self)
end
|
#add_producer(producer) ⇒ Object
56
57
58
59
60
61
|
# File 'lib/frbr/manifestation.rb', line 56
def add_producer(producer)
raise ArgumentError, "Producer must be a Group 2 entity" unless producer.is_a?(FRBR::Group2)
@producers ||= []
@producers << producer unless @producers.index(producer)
producer.add_production(self) unless producer.producer_of?(self)
end
|
73
74
75
76
|
# File 'lib/frbr/manifestation.rb', line 73
def add_related(expression)
(action, relationship) = this_method.split("_")
self.add_relationship_to_entity(expression, relationship.to_sym, FRBR::Manifestation, true)
end
|
#clear_embodiment_of ⇒ Object
Also known as:
clear_manifestation_of
29
30
31
32
33
34
35
36
|
# File 'lib/frbr/manifestation.rb', line 29
def clear_embodiment_of
if @embodiment_of && !@embodiment_of.nil?
if @embodiment_of.embodiments && @embodiment_of.embodiments.index(self)
@embodiment_of.remove_embodiment(self)
end
@embodiment_of = nil
end
end
|
#equivalents ⇒ Object
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/frbr/manifestation.rb', line 10
def equivalents
equivalents = []
if self.embodiment_of
self.embodiment_of.embodiments.each do | manifestation |
next if manifestation == self
equivalents << manifestation
end
end
equivalents
end
|
#has_producer?(agent) ⇒ Boolean
68
69
70
71
|
# File 'lib/frbr/manifestation.rb', line 68
def has_producer?(agent)
return true if @producers && @producers.index(agent)
return false
end
|
#is_embodiment_of(expression) ⇒ Object
Also known as:
is_manifestation_of
21
22
23
24
25
|
# File 'lib/frbr/manifestation.rb', line 21
def is_embodiment_of(expression)
raise ArgumentError, "Must be the embodiment of an expression" unless expression.is_a?(FRBR::Expression)
@embodiment_of = expression
expression.add_embodiment(self) unless expression.embodiments && expression.embodiments.index(self)
end
|
#remove_exemplar(item) ⇒ Object
Also known as:
remove_item
49
50
51
52
|
# File 'lib/frbr/manifestation.rb', line 49
def remove_exemplar(item)
@exemplars.delete(item) if @exemplars
item.clear_exemplar_of
end
|
#remove_producer(producer) ⇒ Object
63
64
65
66
|
# File 'lib/frbr/manifestation.rb', line 63
def remove_producer(producer)
@producers.delete(producer)
producer.remove_production(self) if producer.producer_of?(self)
end
|
78
79
80
81
|
# File 'lib/frbr/manifestation.rb', line 78
def remove_related(expression)
(action, relationship) = this_method.split("_")
self.remove_relationship_from_entity(expression, relationship.to_sym, FRBR::Manifestation, true)
end
|