Class: Pubid::Oiml::SingleIdentifier

Inherits:
Identifier show all
Defined in:
lib/pubid/oiml/single_identifier.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Identifier

#to_urn

Methods inherited from 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, #to_urn, #urn_supplement_type, #urn_type_code, #year

Constructor Details

This class inherits a constructor from Pubid::Identifier

Instance Attribute Details

#requested_formatObject (readonly)

Track parsed format



18
19
20
# File 'lib/pubid/oiml/single_identifier.rb', line 18

def requested_format
  @requested_format
end

Instance Method Details

#edition_portionObject



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/pubid/oiml/single_identifier.rb', line 31

def edition_portion
  # Deprecated - kept for compatibility
  # Use to_s(format: :long) instead
  if edition && date
    "#{edition} Edition #{date.year}"
  elsif date
    "Edition #{date.year}"
  else
    edition
  end
end

#to_s(format: nil, **opts) ⇒ Object



25
26
27
28
29
# File 'lib/pubid/oiml/single_identifier.rb', line 25

def to_s(format: nil, **opts)
  # Store requested format so the renderer can access it
  @requested_format = format
  render(format: :human, **opts)
end

#typeObject

Type is determined by the subclass



21
22
23
# File 'lib/pubid/oiml/single_identifier.rb', line 21

def type
  type_string
end

#type_stringObject

Subclasses override this

Raises:

  • (NotImplementedError)


44
45
46
# File 'lib/pubid/oiml/single_identifier.rb', line 44

def type_string
  raise NotImplementedError, "Subclasses must implement type_string"
end