Sha256: 90b0bf60b10c0c527bdff6fe1320faf6951ec2336238db88485c599d0817ecc4

Contents?: true

Size: 479 Bytes

Versions: 2

Compression:

Stored size: 479 Bytes

Contents

# frozen_string_literal: true

# Helper class for handling user-provided burgees.
#
# @private
class USPSFlags::Burgees::Customs
  def self.available
    Dir.glob("#{USPSFlags.configuration.burgees_dir}/**/*.svg").map do |b|
      b.split('/').last.split('.svg').first.to_sym
    end
  end

  def self.get(burgee)
    raise USPSFlags::Errors::UnknownBurgee unless self.available.include?(burgee)

    ::File.read("#{USPSFlags.configuration.burgees_dir}/#{burgee}.svg")
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
usps_flags-burgees-0.1.1 lib/usps_flags/burgees/customs.rb
usps_flags-burgees-0.1.0 lib/usps_flags/burgees/customs.rb