Sha256: 365cab301643bf2a0de2be4cd74355b89ebd9fda8a7b199f028831552d3c5cb5

Contents?: true

Size: 540 Bytes

Versions: 3

Compression:

Stored size: 540 Bytes

Contents

# frozen_string_literal: true

# Helper class for handling user-provided burgees.
#
# @private
class USPSFlags
  class Burgees
    class 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 available.include?(burgee)

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
usps_flags-burgees-0.1.4 lib/usps_flags/burgees/customs.rb
usps_flags-burgees-0.1.3 lib/usps_flags/burgees/customs.rb
usps_flags-burgees-0.1.2 lib/usps_flags/burgees/customs.rb