glitchier-soc/app/lib/themes.rb

29 lines
480 B
Ruby
Raw Normal View History

2017-09-26 05:24:32 +03:00
# frozen_string_literal: true
require 'singleton'
require 'yaml'
class Themes
include Singleton
def initialize
result = Hash.new
Dir.glob(Rails.root.join('app', 'javascript', 'themes', '*', 'theme.yml')) do |path|
data = YAML.load_file(path)
2017-11-17 07:35:25 +02:00
name = File.basename(File.dirname(path))
if data['pack']
result[name] = data
2017-09-26 05:24:32 +03:00
end
end
@conf = result
end
2017-11-17 07:35:25 +02:00
def get(name)
@conf[name]
end
2017-09-26 05:24:32 +03:00
def names
@conf.keys
end
end