Sha256: 7871d6e3b4df3def8f368d921e467b70fea131437264c61c37cde30cf0fffdf1

Contents?: true

Size: 510 Bytes

Versions: 13

Compression:

Stored size: 510 Bytes

Contents

# Helper class for handling built-in burgees.
#
# @private
class USPSFlags::Burgees::Builtins
  @@builtins_dir = "#{File.expand_path(File.dirname(__FILE__))}/builtins"

  def self.available
    Dir.glob("#{@@builtins_dir}/**/*.svg").map { |b|
      b.split("/").last.split(".svg").first
    }.map(&:to_sym)
  end

  def self.get(burgee)
    raise USPSFlags::Errors::UnknownBurgee "Looked in #{@@builtins_dir}" unless self.available.include?(burgee)
    ::File.read("#{@@builtins_dir}/#{burgee}.svg")
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

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