Class: Bookbinder::Config::TopicConfig
- Inherits:
-
Object
- Object
- Bookbinder::Config::TopicConfig
- Defined in:
- lib/bookbinder/config/topic_config.rb
Constant Summary collapse
- CONFIG_REQUIRED_KEYS =
%w(title toc_path)
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize(config) ⇒ TopicConfig
constructor
A new instance of TopicConfig.
- #title ⇒ Object
- #toc_nav_name ⇒ Object
- #toc_path ⇒ Object
- #valid? ⇒ Boolean
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
#config ⇒ Object (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
#title ⇒ Object
8 9 10 |
# File 'lib/bookbinder/config/topic_config.rb', line 8 def title config['title'] end |
#toc_nav_name ⇒ Object
16 17 18 |
# File 'lib/bookbinder/config/topic_config.rb', line 16 def toc_nav_name config['toc_nav_name'] || title end |
#toc_path ⇒ Object
12 13 14 |
# File 'lib/bookbinder/config/topic_config.rb', line 12 def toc_path Pathname(config['toc_path']) end |
#valid? ⇒ Boolean
20 21 22 |
# File 'lib/bookbinder/config/topic_config.rb', line 20 def valid? (CONFIG_REQUIRED_KEYS - config.keys).empty? end |