Sha256: d7e8c17c212c548813ac40090f9e3c4a2753cdeb17f716d7b6d4c3f8a5b5001e
Contents?: true
Size: 523 Bytes
Versions: 8
Compression:
Stored size: 523 Bytes
Contents
# frozen_string_literal: true module FreightKit module Carriers extend self attr_reader :registered @registered = [] def register(class_name, autoload_require) FreightKit.autoload(class_name, autoload_require) registered << class_name end def all FreightKit::Carriers.registered.map { |name| FreightKit.const_get(name) } end def find(name) all.find { |c| c.name.downcase == name.to_s.downcase } or raise NameError, "unknown carrier #{name}" end end end
Version data entries
8 entries across 8 versions & 1 rubygems