Class: Pubid::Ieee::Identifiers::Nesc::Draft

Inherits:
Base show all
Includes:
CodeNumber
Defined in:
lib/pubid/ieee/identifiers/nesc/draft.rb

Overview

Draft NESC identifier

Represents draft versions of the National Electrical Safety Code that are under development or review.

NOTE: the spelled-out "Draft National Electrical Safety Code, …" form is claimed by the generic IEEE grammar before it reaches the NESC sub-parser, so it does not currently build this class. Pre-existing dispatcher gap, pinned in spec/pubid/ieee/ire_nesc_roundtrip_spec.rb.

Examples:

nesc = Pubid::Ieee.parse("Draft NESC, June 2011")
nesc.to_s
# => "Draft National Electrical Safety Code, June 2011"

Instance Attribute Summary

Attributes inherited from Pubid::Ieee::Identifier

#code_obj, #draft_obj

Class Method Summary collapse

Instance Method Summary collapse

Methods included from CodeNumber

#code_obj, included, #initialize, #rebuild_code_obj_from_split, #sync_split_from_code_obj

Methods inherited from Base

#draft?, #initialize, #name_portion, #publisher_portion, #trademark_symbol

Methods inherited from Pubid::Ieee::Identifier

additional_identifier_classes, #code, #draft, #draft_month, #exclude, from_hash, #initialize, #mr_number_with_part, #mr_publisher, #mr_type, #mr_year, parse, parse_single, #publisher, #to_hash

Methods inherited from Pubid::Identifier

apply_mappings, #base, #base_document, concrete_class_for, #dated_version_of?, #draft_of?, #drop_supplements, #edition_of?, #eql?, #exclude, from_hash, #has_supplement?, #hash, #includes?, #initialize, #matches?, #mr_all_parts, #mr_edition, #mr_languages, #mr_number, #mr_number_with_part, #mr_part, #mr_publisher, #mr_subpart, #mr_supplement_suffix, #mr_type, #mr_year, #new_edition_of?, polymorphic_type_map, #related_to?, #render, #resolve_urn_generator, #root, #sibling_of?, #supplement_of?, #to_hash, #to_mr_string, #to_slug, #to_supplement_s, #to_urn, #urn_supplement_type, #urn_type_code, #year

Class Method Details

.polymorphic_nameObject



24
25
26
# File 'lib/pubid/ieee/identifiers/nesc/draft.rb', line 24

def self.polymorphic_name
  "pubid:ieee:nesc-draft"
end

Instance Method Details

#to_s(trademark: false) ⇒ String

Render draft identifier

Parameters:

  • trademark (Boolean) (defaults to: false)

    append the IEEE trademark symbol (™/®)

Returns:

  • (String)

    Draft format with optional month and year



32
33
34
35
36
37
38
# File 'lib/pubid/ieee/identifiers/nesc/draft.rb', line 32

def to_s(trademark: false)
  parts = ["Draft National Electrical Safety Code"]
  parts << ", #{month} #{year}" if month && year
  result = parts.join
  result += trademark_symbol if trademark
  result
end