Class: Pubid::CenCenelec::Builder
Instance Attribute Summary
#identifier
Class Method Summary
collapse
Instance Method Summary
collapse
#initialize
Class Method Details
.build(parsed_data) ⇒ Object
6
7
8
|
# File 'lib/pubid/cen_cenelec/builder.rb', line 6
def self.build(parsed_data)
new.build(parsed_data)
end
|
Instance Method Details
#build(data) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/pubid/cen_cenelec/builder.rb', line 10
def build(data)
data = flatten_array(data) if data.is_a?(Array)
@data = data
if data[:fragment_number]
return build_fragment_identifier(data)
end
if data[:adopted_string]
if data[:publisher]&.to_s == "ENV"
return build_env_adopted_identifier(data)
end
return build_adopted_identifier(data)
end
if has_slash_supplements?(data)
return build_standalone_supplement(data)
end
supplements_data = (data)
identifier = locate_identifier_klass(data).new
assign_attributes(identifier, data)
if supplements_data.any?
wrap_with_consolidated(identifier, supplements_data)
else
identifier
end
end
|