vt-social/app/lib/themes.rb

29 lines
480 B
Ruby
Raw Normal View History

2017-09-26 02:24:32 +00: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 05:35:25 +00:00
name = File.basename(File.dirname(path))
if data['pack']
result[name] = data
2017-09-26 02:24:32 +00:00
end
end
@conf = result
end
2017-11-17 05:35:25 +00:00
def get(name)
@conf[name]
end
2017-09-26 02:24:32 +00:00
def names
@conf.keys
end
end