Class: Pubid::Iso::Identifiers::Directives
- Inherits:
-
SingleIdentifier
- Object
- Lutaml::Model::Serializable
- Pubid::Identifier
- Pubid::Iso::Identifier
- SingleIdentifier
- Pubid::Iso::Identifiers::Directives
- Defined in:
- lib/pubid/iso/identifiers/directives.rb
Constant Summary collapse
- TYPED_STAGES =
[ ::Pubid::Components::TypedStage.new( code: :pubguide, stage_code: :published, type_code: :dir, abbr: ["DIR", "Directives Part", "Directives, Part", "Directives,", "Directives"], short_abbr: "DIR", long_abbr: "Directives, Part", name: "Directives", harmonized_stages: %w[60.00 60.60], ), ].freeze
Constants inherited from Pubid::Iso::Identifier
Pubid::Iso::Identifier::ISO_TYPE_MAP
Class Method Summary collapse
Instance Method Summary collapse
- #to_s(**opts) ⇒ Object
-
#to_urn ⇒ Object
Directives use a different URN scheme: urn:iso:doc instead of urn:iso:std Format: urn:iso:doc:publisher[:subgroup_number]:dir[:part][:Pubid::Identifier#year].
Methods inherited from Pubid::Iso::Identifier
#all_parts_from_kv, #all_parts_to_kv, #build_code, build_type_map, #copublishers_from_kv, #copublishers_to_kv, #date_for, #day_from_kv, #day_to_kv, default_publisher, #emit_code, #emit_date_part, from_hash, #month_from_kv, #month_to_kv, #number_from_kv, #number_to_kv, parse, #part_from_kv, #part_to_kv, published_typed_stage, #publisher_for, #publisher_from_kv, #publisher_to_kv, #stage, #stage_from_kv, #stage_iteration_from_kv, #stage_iteration_to_kv, #stage_to_kv, #subpart_from_kv, #subpart_to_kv, #type, #with_harmonized_stage, #year_from_kv, #year_to_kv
Methods inherited from Pubid::Identifier
#base_identifier, #eql?, #exclude, #hash, #initialize, #mr_number, #mr_number_with_part, #mr_part, #mr_publisher, #mr_type, #mr_year, #new_edition_of?, polymorphic_name, #render, #resolve_urn_generator, #root, #to_mr_string, #to_supplement_s, #urn_supplement_type, #urn_type_code, #year
Constructor Details
This class inherits a constructor from Pubid::Identifier
Class Method Details
.type ⇒ Object
29 30 31 32 |
# File 'lib/pubid/iso/identifiers/directives.rb', line 29 def self.type { key: :dir, web: :directives, title: "Directives", short: "DIR" } end |
Instance Method Details
#to_s(**opts) ⇒ Object
34 35 36 37 38 |
# File 'lib/pubid/iso/identifiers/directives.rb', line 34 def to_s(**opts) context = build_rendering_context(nil, format: :human, **opts) Pubid::Renderers::DirectivesRenderer.new(self).render(context:, **opts.slice(:with_edition)) end |
#to_urn ⇒ Object
Directives use a different URN scheme: urn:iso:doc instead of urn:iso:std Format: urn:iso:doc:publisher[:subgroup_number]:dir[:part][:Pubid::Identifier#year]
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/pubid/iso/identifiers/directives.rb', line 42 def to_urn parts = ["urn", "iso", "doc"] copubs = copublishers || [] parts << ([publisher] + copubs).map(&:body).map(&:downcase).join("-") if subgroup subgroup_parts = subgroup.value.split parts << subgroup_parts[0].downcase if subgroup_parts[0] parts << subgroup_parts[1] if subgroup_parts[1] end parts << "dir" parts << number.value if number parts << part.value.downcase if part parts << date.year if date parts.join(":") end |