Class: Jekyll::AwesomeNav::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll/awesome_nav/config.rb

Constant Summary collapse

DEFAULTS =
{
  "enabled" => true,
  "root" => "docs",
  "nav_filename" => ".nav.yml"
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(raw_config) ⇒ Config

Returns a new instance of Config.

Raises:



12
13
14
15
16
# File 'lib/jekyll/awesome_nav/config.rb', line 12

def initialize(raw_config)
  raise Error, "awesome_nav config must be a mapping" unless raw_config.nil? || raw_config.is_a?(Hash)

  @data = DEFAULTS.merge(raw_config || {})
end

Instance Method Details

#enabled?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/jekyll/awesome_nav/config.rb', line 18

def enabled?
  @data["enabled"]
end


26
27
28
# File 'lib/jekyll/awesome_nav/config.rb', line 26

def nav_filename
  @data["nav_filename"].to_s
end

#root_dirObject



22
23
24
# File 'lib/jekyll/awesome_nav/config.rb', line 22

def root_dir
  Utils.normalize_dir(@data["root"])
end