Class: JekyllMetrics::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll-metrics/config.rb

Overview

Hold the configuration needed for Hook to work

Constant Summary collapse

CONFIG_NAME =
'jekyll_metrics'
DEFAULT_TEMPLATE_PATH =
'lib/jekyll-metrics/includes/metrics.html.liquid'
DEFAULT_CONFIG =
{
  'template'            => DEFAULT_TEMPLATE_PATH,
  'yandex_metrica_id'   => 'XXXXXXXX',
  'google_analytics_id' => 'XX-XXXXXXXXX-X',
}.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(site) ⇒ Config



22
23
24
# File 'lib/jekyll-metrics/config.rb', line 22

def initialize(site)
  @site = site
end

Instance Attribute Details

#siteObject

Returns the value of attribute site.



20
21
22
# File 'lib/jekyll-metrics/config.rb', line 20

def site
  @site
end

Class Method Details

.instance(site) ⇒ Object



15
16
17
# File 'lib/jekyll-metrics/config.rb', line 15

def instance(site)
  @instance ||= Config.new(site)
end

Instance Method Details

#plugin_varsObject



30
31
32
# File 'lib/jekyll-metrics/config.rb', line 30

def plugin_vars
  @plugin_vars ||= DEFAULT_CONFIG.merge(plugin_config)
end

#template_pathObject



26
27
28
# File 'lib/jekyll-metrics/config.rb', line 26

def template_path
  @template_path ||= build_template_path
end