Sha256: 149123dc153d38f9eefd15116e8947ae36f60e9132e12e5e5552b1fe83902a45

Contents?: true

Size: 761 Bytes

Versions: 18

Compression:

Stored size: 761 Bytes

Contents

# frozen_string_literal: true

require_relative '../logger'
require_relative 'paths'

module CloudCannonJekyll
  # Generator functions for site data
  class Data
    def initialize(site, config)
      @site = site
      @config = config
    end

    def generate_data
      data_config = @config['data_config']
      data = case data_config
             when true
               @site.data&.dup
             when Hash
               @site.data&.select { |key, _| data_config.key?(key) && data_config[key] }
             end

      data ||= {}
      data['categories'] ||= @site.categories.keys
      data['tags'] ||= @site.tags.keys

      data.each_key do |key|
        Logger.info "💾 Processed #{key.bold} data set"
      end

      data
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
cloudcannon-jekyll-4.1.0 lib/cloudcannon-jekyll/generators/data.rb
cloudcannon-jekyll-4.0.7 lib/cloudcannon-jekyll/generators/data.rb
cloudcannon-jekyll-4.0.6 lib/cloudcannon-jekyll/generators/data.rb
cloudcannon-jekyll-4.0.5 lib/cloudcannon-jekyll/generators/data.rb
cloudcannon-jekyll-4.0.4 lib/cloudcannon-jekyll/generators/data.rb
cloudcannon-jekyll-4.0.3 lib/cloudcannon-jekyll/generators/data.rb
cloudcannon-jekyll-4.0.2 lib/cloudcannon-jekyll/generators/data.rb
cloudcannon-jekyll-4.0.1 lib/cloudcannon-jekyll/generators/data.rb
cloudcannon-jekyll-4.0.0 lib/cloudcannon-jekyll/generators/data.rb
cloudcannon-jekyll-3.2.4 lib/cloudcannon-jekyll/generators/data.rb
cloudcannon-jekyll-3.2.3 lib/cloudcannon-jekyll/generators/data.rb
cloudcannon-jekyll-3.2.2 lib/cloudcannon-jekyll/generators/data.rb
cloudcannon-jekyll-3.2.1 lib/cloudcannon-jekyll/generators/data.rb
cloudcannon-jekyll-3.2.0 lib/cloudcannon-jekyll/generators/data.rb
cloudcannon-jekyll-3.1.0 lib/cloudcannon-jekyll/generators/data.rb
cloudcannon-jekyll-3.0.2 lib/cloudcannon-jekyll/generators/data.rb
cloudcannon-jekyll-3.0.1 lib/cloudcannon-jekyll/generators/data.rb
cloudcannon-jekyll-3.0.0 lib/cloudcannon-jekyll/generators/data.rb