Sha256: 8a83cd95f2b91eec34f726b738b62f5033d3f0f0176f914bcb5e625235a308fa

Contents?: true

Size: 435 Bytes

Versions: 3

Compression:

Stored size: 435 Bytes

Contents

# Helper class for handling user-provided burgees.
#
# @private
class USPSFlags::Burgees::Customs
  def self.available
    Dir.glob("#{USPSFlags::Config.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::Config.burgees_dir}/#{burgee}.svg")
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
usps_flags-burgees-0.0.8 lib/usps_flags/burgees/customs.rb
usps_flags-burgees-0.0.7 lib/usps_flags/burgees/customs.rb
usps_flags-burgees-0.0.6 lib/usps_flags/burgees/customs.rb