Sha256: 824b25872907535df1a5754284cb3763399d4193f25b1e1921e6db4200d9a0cc

Contents?: true

Size: 423 Bytes

Versions: 2

Compression:

Stored size: 423 Bytes

Contents

# frozen_string_literal: true

require_relative './registry'

module Multicodecs

  module_function

  def load_csv(csv, radix: 16)
    csv.each do |row|
      name  = row['name'] || row[0]
      tag   = row['tag']  || row[1]
      code  = row['code'] || row[2]

      Multicodecs.register(
        name: name.strip,
        tag: tag.strip,
        code: code.strip.to_i(16)
      )
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
multicodecs-0.2.1 lib/multicodecs/bare.rb
multicodecs-0.2.0 lib/multicodecs/bare.rb