Class: Pubid::Ieee::Identifiers::Nesc::Base

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/pubid/ieee/identifiers/nesc/base.rb

Overview

Base class for National Electrical Safety Code (NESC) identifiers

NESC is published by IEEE Standards Association and covers electrical safety standards for utilities and communication systems.

Examples:

Standard format

nesc = Pubid::Ieee.parse("C2-1997 National Electric Safety Code")
nesc.code.value  # => "C2"
nesc.year.year   # => 1997

Handbook format

nesc = Pubid::Ieee.parse("2017 NESC Handbook, Premier Edition")
nesc.year.year   # => 2017
nesc.variant     # => "Handbook"
nesc.edition     # => "Premier Edition"

Direct Known Subclasses

Draft, Handbook, Redline, Standard

Instance Method Summary collapse

Instance Method Details

#publisher_portionString

Publisher portion for NESC identifiers

Returns:

  • (String)

    Always returns “NESC”



35
36
37
# File 'lib/pubid/ieee/identifiers/nesc/base.rb', line 35

def publisher_portion
  "NESC"
end

#to_sString

Base rendering - override in subclasses

Returns:

  • (String)

    String representation



42
43
44
45
46
47
48
49
50
51
# File 'lib/pubid/ieee/identifiers/nesc/base.rb', line 42

def to_s
  parts = []
  if code && year
    parts << "#{code}-#{year.year}"
  elsif year
    parts << year.year.to_s
  end
  parts << "National Electrical Safety Code"
  parts.join(" ")
end