Sha256: 850371ac01618bbb800a0539e074995d5b4f3113b0fd164471d3e530398f831b

Contents?: true

Size: 447 Bytes

Versions: 14

Compression:

Stored size: 447 Bytes

Contents

# 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

14 entries across 14 versions & 1 rubygems

Version Path
usps_flags-burgees-0.0.22 lib/usps_flags/burgees/customs.rb
usps_flags-burgees-0.0.21 lib/usps_flags/burgees/customs.rb
usps_flags-burgees-0.0.20 lib/usps_flags/burgees/customs.rb
usps_flags-burgees-0.0.19 lib/usps_flags/burgees/customs.rb
usps_flags-burgees-0.0.18 lib/usps_flags/burgees/customs.rb
usps_flags-burgees-0.0.17 lib/usps_flags/burgees/customs.rb
usps_flags-burgees-0.0.16 lib/usps_flags/burgees/customs.rb
usps_flags-burgees-0.0.15 lib/usps_flags/burgees/customs.rb
usps_flags-burgees-0.0.14 lib/usps_flags/burgees/customs.rb
usps_flags-burgees-0.0.13 lib/usps_flags/burgees/customs.rb
usps_flags-burgees-0.0.12 lib/usps_flags/burgees/customs.rb
usps_flags-burgees-0.0.11 lib/usps_flags/burgees/customs.rb
usps_flags-burgees-0.0.10 lib/usps_flags/burgees/customs.rb
usps_flags-burgees-0.0.9 lib/usps_flags/burgees/customs.rb