class Jekyll::LanguagePlugin::Loaders::BaseLoader

Attributes

site[R]

Public Class Methods

new(site) click to toggle source
# File lib/jekyll/language-plugin/loaders/base_loader.rb, line 10
def initialize(site)
  @site = site
  @is_loaded = false
end

Public Instance Methods

get(key, language) click to toggle source
# File lib/jekyll/language-plugin/loaders/base_loader.rb, line 23
def get(key, language)
  nil
end
get_with_placeholders(key, tokens, language) click to toggle source
# File lib/jekyll/language-plugin/loaders/base_loader.rb, line 27
def get_with_placeholders(key, tokens, language)
  res = get(key, language)
  return nil if res.nil?
  res.gsub(/%%/).with_index { |m, i| tokens[i] || m }
end
load(language) click to toggle source
# File lib/jekyll/language-plugin/loaders/base_loader.rb, line 19
def load(language)
  true
end
loaded?(language) click to toggle source
# File lib/jekyll/language-plugin/loaders/base_loader.rb, line 15
def loaded?(language)
  true
end
resolve_dot_notation(keys) click to toggle source
# File lib/jekyll/language-plugin/loaders/base_loader.rb, line 42
def resolve_dot_notation(keys)
  return keys.split('.') if keys.is_a?(String)
  return [] if !keys.is_a?(Enumerable)

  keys.flat_map do |key|
    resolve_dot_notation(key)
  end
end
traverse_hash(hash, keys) click to toggle source
# File lib/jekyll/language-plugin/loaders/base_loader.rb, line 33
def traverse_hash(hash, keys)
  for key in keys
    return hash unless hash.is_a?(Hash)
    return nil unless hash.key?(key)
    hash = hash[key]
  end
  hash
end