Module: AssetPages::Util
- Defined in:
- lib/asset_pages/util.rb
Class Method Summary collapse
Class Method Details
.fetch_nested(hash, *keys) ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/asset_pages/util.rb', line 42 def self.fetch_nested(hash, *keys) keys.reduce(hash) do |hash, key| if hash.respond_to?(:[]) hash[key] else nil end end end |
.find_yaml_configs ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/asset_pages/util.rb', line 22 def self.find_yaml_configs root = ::Rails.application.root configs = [] default_config = root + "_config.yml" configs.push(default_config) \ if default_config.file? configs += (root + "config/jekyll").children.select do |pathname| pathname.file? && pathname.extname == ".yml" end configs end |
.jekyll_config ⇒ Object
38 39 40 |
# File 'lib/asset_pages/util.rb', line 38 def self.jekyll_config ::Jekyll.configuration(config: find_yaml_configs) end |