class Jekyll::Aplayer::Config

Constants

CONFIG_NAME
DEFAULT_CONFIG

Public Class Methods

get(uuid) click to toggle source
# File lib/jekyll-aplayer/cores/config.rb, line 45
def self.get(uuid)
  @@_store_config[uuid] if @@_store_config.key?(uuid)
end
load(config = {}) click to toggle source
# File lib/jekyll-aplayer/cores/config.rb, line 57
def self.load(config = {})
  config = {}.deep_merge!({
    CONFIG_NAME => DEFAULT_CONFIG
  }).deep_merge!(config)[CONFIG_NAME]
  @@_site_config = config
end
load_config(&block) click to toggle source
# File lib/jekyll-aplayer/cores/config.rb, line 64
def self.load_config(&block)
  # post load site config for `group :jekyll_plugin`
  Jekyll::Hooks.register :site, :after_init do |site|
    self.load(site.config)
    block.call()
  end
end
normalize?(config) click to toggle source
# File lib/jekyll-aplayer/cores/config.rb, line 36
def self.normalize?(config)
  cpy = config.without?('processor', 'assets', 'id', 'class', 'container', 'customAudioType')
  # Convert string to real datatype.
  cpy.map { |key, value|
    method = 'to_' + Type.datatype?(key)
    value.respond_to?(method) ? [key, value.send(method)] : [key, value]
  }.to_h
end
site_config() click to toggle source
# File lib/jekyll-aplayer/cores/config.rb, line 53
def self.site_config()
  @@_site_config
end
store(uuid, config) click to toggle source
# File lib/jekyll-aplayer/cores/config.rb, line 49
def self.store(uuid, config)
  @@_store_config[uuid] = config
end