Method: EpoOps::IpcClassUtil.parse_generic_format

Defined in:
lib/epo_ops/ipc_class_util.rb

.parse_generic_format(generic) ⇒ String

There is a generic format for ipc classes that does not have the / as delimiter and leaves space for additions. This parses it into the format the register search understands

Examples:

parse_generic_format('A01B0003140000') #=> 'A01B3/14'

Parameters:

  • generic (String)

    ipc class in generic format

Returns:

  • (String)

    reformatted ipc class



24
25
26
27
28
29
30
31
# File 'lib/epo_ops/ipc_class_util.rb', line 24

def self.parse_generic_format(generic)
  ipc_class = generic
  if ipc_class.length > 4
    match = ipc_class.match(/([A-Z]\d{2}[A-Z])(\d{4})(\d{6})$/)
    ipc_class = match[1] + (match[2].to_i).to_s + '/' + process_number(match[3])
  end
  ipc_class
end