Sha256: 8d77fb51d5fe10b44255ad804c5b0040156dc984afe0a6fe828a450b7db6c25e
Contents?: true
Size: 653 Bytes
Versions: 5
Compression:
Stored size: 653 Bytes
Contents
module Ddr Contact = Struct.new(:slug, :name, :short_name, :url, :phone, :email, :ask, keyword_init: true) do def self.config @config ||= YAML.load_file(::File.expand_path('../../../config/aux/contact.yml', __dir__)) end def self.keystore @keystore ||= Hash[config.map { |entry| [entry['slug'], new(entry).freeze] }].freeze end def self.all keystore.values end def self.call(slug) keystore.fetch(slug) rescue KeyError => _ raise Ddr::NotFoundError, "Contact slug '#{slug}' not found." end def self.keys keystore.keys end def to_s name end end end
Version data entries
5 entries across 5 versions & 1 rubygems