Sha256: 6fe95dcd5990c33ca937e443cba3de452f0ae3545e19231ae6693f64a7edb729

Contents?: true

Size: 517 Bytes

Versions: 4

Compression:

Stored size: 517 Bytes

Contents

# frozen_string_literal: true

module MetadataV14
  class << self
    def build_registry(metadata)
      types = metadata._get(:lookup)._get(:types)
      types.map { |type| [type._get(:id), type._get(:type)] }.to_h
    end

    def get_storage_item(pallet_name, item_name, metadata)
      pallet =
        metadata._get(:pallets).find do |p|
          p._get(:name) == pallet_name
        end

      pallet._get(:storage)._get(:items).find do |item|
        item._get(:name) == item_name
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
scale_rb-0.1.3 lib/metadata_v14.rb
scale_rb-0.1.2 lib/metadata_v14.rb
scale_rb-0.1.1 lib/metadata_v14.rb
scale_rb-0.1.0 lib/metadata_v14.rb