You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
418 B

  1. # frozen_string_literal: true
  2. require 'singleton'
  3. require 'yaml'
  4. class Themes
  5. include Singleton
  6. def initialize
  7. result = Hash.new
  8. Dir.glob(Rails.root.join('app', 'javascript', 'themes', '*', 'theme.yml')) do |path|
  9. data = YAML.load_file(path)
  10. if data['pack'] && data['name']
  11. result[data['name']] = data
  12. end
  13. end
  14. @conf = result
  15. end
  16. def names
  17. @conf.keys
  18. end
  19. end