Class: Relaton::Ietf::Rfc::Entry
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Relaton::Ietf::Rfc::Entry
- Defined in:
- lib/relaton/ietf/rfc/entry.rb
Overview
Model for index entries (bcp-entry, fyi-entry, std-entry, rfc-entry)
Constant Summary collapse
- TITLE_PREFIXES =
rubocop:disable Metrics/ClassLength
{ "bcp" => "Best Current Practice", "fyi" => "For Your Information", "std" => "Internet Standard technical specification", }.freeze
Instance Method Summary collapse
-
#anchor ⇒ String
Generate anchor string (e.g., “BCP1”).
-
#entry_type ⇒ String?
Determine entry type from doc-id prefix.
-
#has_is_also? ⇒ Boolean
Check if this entry has is-also references.
-
#pub_id ⇒ String
Generate public identifier (e.g., “BCP 1”).
-
#rfc_entry? ⇒ Boolean
Check if this is an rfc-entry.
-
#shortnum ⇒ String
Extract short number from doc-id (e.g., “BCP0001” -> “1”).
-
#to_item(rfc_index = nil, wg_names: {}) ⇒ Relaton::Ietf::ItemData?
Convert to Relaton::Ietf::ItemData.
-
#to_rfc_item(wg_names: {}) ⇒ Object
rubocop:disable Metrics/MethodLength.
Instance Method Details
#anchor ⇒ String
Generate anchor string (e.g., “BCP1”)
114 115 116 |
# File 'lib/relaton/ietf/rfc/entry.rb', line 114 def anchor "#{entry_type&.upcase}#{shortnum}" end |
#entry_type ⇒ String?
Determine entry type from doc-id prefix
78 79 80 |
# File 'lib/relaton/ietf/rfc/entry.rb', line 78 def entry_type doc_id&.downcase&.match(/^(bcp|fyi|std|rfc)/)&.[](1) end |
#has_is_also? ⇒ Boolean
Check if this entry has is-also references
123 124 125 |
# File 'lib/relaton/ietf/rfc/entry.rb', line 123 def has_is_also? is_also&.doc_id&.any? || false end |
#pub_id ⇒ String
Generate public identifier (e.g., “BCP 1”)
105 106 107 |
# File 'lib/relaton/ietf/rfc/entry.rb', line 105 def pub_id "#{entry_type&.upcase} #{shortnum}" end |
#rfc_entry? ⇒ Boolean
Check if this is an rfc-entry
87 88 89 |
# File 'lib/relaton/ietf/rfc/entry.rb', line 87 def rfc_entry? entry_type == "rfc" end |
#shortnum ⇒ String
Extract short number from doc-id (e.g., “BCP0001” -> “1”)
96 97 98 |
# File 'lib/relaton/ietf/rfc/entry.rb', line 96 def shortnum doc_id&.match(/\d+$/)&.to_s&.sub(/^0+/, "") || "" end |
#to_item(rfc_index = nil, wg_names: {}) ⇒ Relaton::Ietf::ItemData?
Convert to Relaton::Ietf::ItemData
133 134 135 136 137 138 139 |
# File 'lib/relaton/ietf/rfc/entry.rb', line 133 def to_item(rfc_index = nil, wg_names: {}) if rfc_entry? to_rfc_item(wg_names: wg_names) else to_subseries_item(rfc_index, wg_names: wg_names) end end |
#to_rfc_item(wg_names: {}) ⇒ Object
rubocop:disable Metrics/MethodLength
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/relaton/ietf/rfc/entry.rb', line 141 def to_rfc_item(wg_names: {}) # rubocop:disable Metrics/MethodLength args = { type: "standard", language: ["en"], script: ["Latn"], docidentifier: build_rfc_docid, docnumber: doc_id, title: build_rfc_title, source: build_rfc_link, date: build_rfc_date, contributor: build_rfc_contributor(wg_names), status: build_rfc_status, keyword: build_rfc_keyword, abstract: build_rfc_abstract, relation: build_rfc_relation, series: build_rfc_series, ext: build_rfc_ext, } ItemData.new(**args) end |