Class: Pubid::Plateau::Identifier::Base
- Inherits:
-
Core::Identifier::Base
- Object
- Core::Identifier::Base
- Pubid::Plateau::Identifier::Base
show all
- Extended by:
- Forwardable
- Defined in:
- lib/pubid/plateau/identifier/base.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(number:, publisher: "PLATEAU", annex: nil, edition: nil, **opts) ⇒ Base
Returns a new instance of Base.
14
15
16
17
18
|
# File 'lib/pubid/plateau/identifier/base.rb', line 14
def initialize(number:, publisher: "PLATEAU", annex: nil, edition: nil, **opts)
@annex = annex if annex
@edition = edition if edition
super(**opts.merge(publisher: publisher, number: number.to_i))
end
|
Instance Attribute Details
#annex ⇒ Object
Returns the value of attribute annex.
8
9
10
|
# File 'lib/pubid/plateau/identifier/base.rb', line 8
def annex
@annex
end
|
#type ⇒ Object
Returns the value of attribute type.
8
9
10
|
# File 'lib/pubid/plateau/identifier/base.rb', line 8
def type
@type
end
|
Class Method Details
.get_parser_class ⇒ Object
29
30
31
|
# File 'lib/pubid/plateau/identifier/base.rb', line 29
def get_parser_class
Parser
end
|
.get_renderer_class ⇒ Object
33
34
35
|
# File 'lib/pubid/plateau/identifier/base.rb', line 33
def get_renderer_class
Renderer::Base
end
|
.get_update_codes ⇒ Object
37
38
39
|
# File 'lib/pubid/plateau/identifier/base.rb', line 37
def get_update_codes
UPDATE_CODES
end
|
21
22
23
24
25
26
27
|
# File 'lib/pubid/plateau/identifier/base.rb', line 21
def transform(params)
identifier_params = params.map do |k, v|
get_transformer_class.new.apply(k => v).to_a.first
end.to_h
Identifier.create(**identifier_params)
end
|
.type ⇒ Object
10
11
12
|
# File 'lib/pubid/plateau/identifier/base.rb', line 10
def self.type
{ key: :plateau }
end
|