Class: Bookbinder::Config::TopicConfig

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

Constant Summary collapse

CONFIG_REQUIRED_KEYS =
%w(title toc_path)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ TopicConfig

Returns a new instance of TopicConfig.



4
5
6
# File 'lib/bookbinder/config/topic_config.rb', line 4

def initialize(config)
  @config = config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



26
27
28
# File 'lib/bookbinder/config/topic_config.rb', line 26

def config
  @config
end

Instance Method Details

#titleObject



8
9
10
# File 'lib/bookbinder/config/topic_config.rb', line 8

def title
  config['title']
end

#toc_nav_nameObject



16
17
18
# File 'lib/bookbinder/config/topic_config.rb', line 16

def toc_nav_name
  config['toc_nav_name'] || title
end

#toc_pathObject



12
13
14
# File 'lib/bookbinder/config/topic_config.rb', line 12

def toc_path
  Pathname(config['toc_path'])
end

#valid?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/bookbinder/config/topic_config.rb', line 20

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