Class: ONIX::Entity
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from GlnMethods
#gln, #gln_identifier
Methods inherited from SubsetDSL
_ancestor_registered_scopes, _ancestors_registered_elements, ancestor_registered_scopes, ancestors_registered_elements, element, elements, get_class, ref_to_short, registered_elements, registered_scopes, scope, short_to_ref, #unsupported
Methods inherited from Subset
parse, #tag_match, tag_match, #unsupported
Constructor Details
#initialize ⇒ Entity
Returns a new instance of Entity.
19
20
21
22
|
# File 'lib/onix/entity.rb', line 19
def initialize
super
@identifiers = []
end
|
Instance Attribute Details
#identifiers ⇒ Object
14
15
16
|
# File 'lib/onix/entity.rb', line 14
def identifiers
@identifiers
end
|
#name ⇒ Object
10
11
12
|
# File 'lib/onix/entity.rb', line 10
def name
@name
end
|
#role ⇒ Object
12
13
14
|
# File 'lib/onix/entity.rb', line 12
def role
@role
end
|
Class Method Details
.identifier_class ⇒ Object
57
58
59
|
# File 'lib/onix/entity.rb', line 57
def self.identifier_class
nil
end
|
.identifier_tag ⇒ Object
32
33
34
|
# File 'lib/onix/entity.rb', line 32
def self.identifier_tag
"#{self.prefix}Identifier"
end
|
.name_tag ⇒ Object
28
29
30
|
# File 'lib/onix/entity.rb', line 28
def self.name_tag
"#{self.prefix}Name"
end
|
.prefix ⇒ Object
54
55
|
# File 'lib/onix/entity.rb', line 54
def self.prefix
end
|
.role_class ⇒ Object
61
62
63
|
# File 'lib/onix/entity.rb', line 61
def self.role_class
nil
end
|
.role_tag ⇒ Object
24
25
26
|
# File 'lib/onix/entity.rb', line 24
def self.role_tag
"#{self.prefix}Role"
end
|
Instance Method Details
#parse(n) ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/onix/entity.rb', line 36
def parse(n)
super
n.children.each do |t|
case t
when tag_match(self.class.name_tag)
@name=t.text
when tag_match(self.class.role_tag)
if self.class.role_class
@role=self.class.role_class.parse(t)
end
when tag_match(self.class.identifier_tag)
if self.class.identifier_class
@identifiers << self.class.identifier_class.parse(t)
end
end
end
end
|