1
0
puyopuyotetr.is/app/lib/themes.rb

29 lines
480 B
Ruby
Raw Normal View History

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