Class: Bookbinder::Config::SubnavConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/bookbinder/config/subnav_config.rb

Constant Summary collapse

CONFIG_REQUIRED_KEYS =
%w(name topics)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ SubnavConfig

Returns a new instance of SubnavConfig.



6
7
8
9
# File 'lib/bookbinder/config/subnav_config.rb', line 6

def initialize(config)
  @config = config
  @topics = assemble_topics || []
end

Instance Attribute Details

#topicsObject (readonly)

Returns the value of attribute topics.



29
30
31
# File 'lib/bookbinder/config/subnav_config.rb', line 29

def topics
  @topics
end

Instance Method Details

#pdf_configObject



15
16
17
# File 'lib/bookbinder/config/subnav_config.rb', line 15

def pdf_config
  config['pdf_config']
end


19
20
21
# File 'lib/bookbinder/config/subnav_config.rb', line 19

def subnav_exclusions
  config['subnav_exclusions'] || []
end


11
12
13
# File 'lib/bookbinder/config/subnav_config.rb', line 11

def subnav_name
  config['name']
end

#valid?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/bookbinder/config/subnav_config.rb', line 23

def valid?
  (CONFIG_REQUIRED_KEYS - config.keys).empty?
end