Class: Bookbinder::Config::ProductConfig

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

Constant Summary collapse

CONFIG_REQUIRED_KEYS =
%w(id subnav_topics)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ ProductConfig

Returns a new instance of ProductConfig.



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

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

Instance Attribute Details

Returns the value of attribute subnav_topics.



33
34
35
# File 'lib/bookbinder/config/product_config.rb', line 33

def subnav_topics
  @subnav_topics
end

Instance Method Details

#idObject Also known as: subnav_name



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

def id
  config['id']
end

#pdf_configObject



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

def pdf_config
  config['pdf_config']
end

#specifies_subnav?Boolean

Returns:

  • (Boolean)


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

def specifies_subnav?
  !subnav_topics.empty?
end


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

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

#valid?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/bookbinder/config/product_config.rb', line 27

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