Sha256: 39984f2d79ad80095f93d01fc466fdfe51680ac8fe549845c63493fff9498604

Contents?: true

Size: 1.29 KB

Versions: 3

Compression:

Stored size: 1.29 KB

Contents

require 'ostruct'

module RevealCK
  # A Config represents core configuration options within
  # reveal-ck. It has defaults. It is mutable.
  class Config < OpenStruct
    def initialize
      super defaults
    end

    def merge!(hash)
      hash.each_pair do |name, value|
        modifiable[new_ostruct_member(name)] = value
      end
    end

    def defaults
      [core_defaults,
       revealjs_config_defaults,
       filter_defaults].reduce({}) { |acc, elem| acc.merge(elem) }
    end

    def core_defaults
      {
        'title'       => 'Slides',
        'description' => '',
        'author'      => '',
        'theme'       => 'black',
        'transition'  => 'default',
        'data' => {

        }
      }
    end

    def revealjs_config_defaults
      {
        'revealjs_config' => {
          'controls' => true,
          'progress' => true,
          'history' => true,
          'center' => true
        }
      }
    end

    def filter_defaults
      {
        'filters' => ['HTML::Pipeline::RevealCKEmojiFilter',
                      'HTML::Pipeline::MentionFilter',
                      'HTML::Pipeline::AutolinkFilter'],
        'asset_root' => 'https://assets-cdn.github.com/images/icons/',
        'base_url' => 'https://github.com',
        'requires' => []
      }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
reveal-ck-3.5.1 lib/reveal-ck/config.rb
reveal-ck-3.5.0 lib/reveal-ck/config.rb
reveal-ck-3.4.0 lib/reveal-ck/config.rb