lib/reveal-ck/config.rb in reveal-ck-0.1.7 vs lib/reveal-ck/config.rb in reveal-ck-0.1.8
- old
+ new
@@ -1,75 +1,46 @@
-require 'toml'
+require 'yaml'
module RevealCK
#
# Public: The Config module supports the core metadata surrounding a
# RevealCK Presentation: title, author, theme, and transition.
#
module Config
+ attr_writer :author, :title, :theme, :transition
+
def author
@author || DEFAULTS['author']
end
- def author=(author)
- @author = author
- end
-
def title
@title || DEFAULTS['title']
end
- def title=(title)
- @title = title
- end
-
def theme
@theme || DEFAULTS['theme']
end
- def theme=(theme)
- @theme = theme
- end
-
def transition
@transition || DEFAULTS['transition']
end
- def transition=(transition)
- @transition = transition
- end
-
DEFAULTS = {
'title' => 'Slides',
'author' => '',
'theme' => 'default',
'transition' => 'default'
}
def merge_config(args)
file = args[:file] || raise(':file is required')
- config = TOML.load_file file
+ config = YAML.load_file file
- if config['author']
- @author = config['author'] unless @author
- end
-
- if config['title']
- @title = config['title'] unless @title
- end
-
- if config['presentation']
- presentation = config['presentation']
- if presentation['theme']
- @theme = presentation['theme'] unless @theme
- end
-
- if presentation['transition']
- @transition = presentation['transition'] unless @transition
- end
- end
-
+ @author = @author || config['author']
+ @title = @title || config['title']
+ @theme = @theme || config['theme']
+ @transition = @transition || config['transition']
end
end
end