Class: Pubid::Ieee::Identifiers::Nesc::Handbook

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

Overview

NESC Handbook identifier

Represents NESC Handbook publications which provide comprehensive guidance and interpretation of the National Electrical Safety Code.

Examples:

Basic handbook

nesc = Pubid::Ieee.parse("2012 NESC Handbook")
nesc.to_s  # => "IEEE Std 2012 NESC Handbook"

With edition

nesc = Pubid::Ieee.parse("2017 NESC Handbook, Premier Edition")
nesc.to_s  # => "IEEE Std 2017 NESC Handbook, Premier Edition"

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



22
23
24
# File 'lib/pubid/ieee/identifiers/nesc/handbook.rb', line 22

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

Instance Method Details

#to_s(trademark: false) ⇒ String

Render handbook identifier

Parameters:

  • trademark (Boolean) (defaults to: false)

    append the IEEE trademark symbol (™/®)

Returns:

  • (String)

    YYYY NESC Handbook format with optional edition



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

def to_s(trademark: false)
  abbr = "NESC"
  abbr += "(R)" if registered
  parts = [["IEEE Std", year, "#{abbr} Handbook"].compact.join(" ")]
  parts << ", #{edition}" if edition
  result = parts.join
  result += trademark_symbol if trademark
  result
end