lib/reveal-ck/config.rb in reveal-ck-0.3.0 vs lib/reveal-ck/config.rb in reveal-ck-0.4.0
- old
+ new
@@ -4,31 +4,54 @@
module RevealCK
# A Config represents core configuration options within
# reveal-ck. It has defaults. It is mutable.
class Config < OpenStruct
def initialize
- super DEFAULTS
+ super defaults
end
def merge!(hash)
hash.each_pair do |name, value|
modifiable[new_ostruct_member(name)] = value
end
end
- DEFAULTS = {
- 'title' => 'Slides',
- 'author' => '',
- 'theme' => 'default',
- 'transition' => 'default',
- 'revealjs_config' => {
- 'controls' => true,
- 'progress' => true,
- 'history' => true,
- 'center' => true
- },
- 'data' => {
+ def defaults
+ [core_defaults,
+ revealjs_config_defaults,
+ filter_defaults].reduce({}) { |a, e| a.merge(e) }
+ end
+ def core_defaults
+ {
+ 'title' => 'Slides',
+ 'author' => '',
+ 'theme' => 'default',
+ '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'
+ }
+ end
end
end