lib/reveal-ck/config.rb in reveal-ck-0.1.5 vs lib/reveal-ck/config.rb in reveal-ck-0.1.6
- old
+ new
@@ -1,33 +1,38 @@
require 'toml'
module RevealCK
+ #
+ # Public: A Config knows about the core configuration values of a
+ # RevealCK Presentation: title, author, theme, etc. It knows about
+ # sensible defaults, and it can read these from a toml file.
+ #
class Config
- def initialize(args={})
+ def initialize(args = {})
config_file = args[:config_file]
@config = load_config config_file
end
def title
- @config["title"]
+ @config['title']
end
def author
- @config["author"]
+ @config['author']
end
def theme
- @config["presentation"]["theme"]
+ @config['presentation']['theme']
end
private
DEFAULTS = {
- "title" => "Slides",
- "author" => "Hakim El Hattab",
- "presentation" => {
- "theme" => "default"
+ 'title' => 'Slides',
+ 'author' => 'Hakim El Hattab',
+ 'presentation' => {
+ 'theme' => 'default'
}
}
def load_config(config_file)
config = DEFAULTS.dup