Class: Bookbinder::Subnav::SubnavGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/bookbinder/subnav/subnav_generator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json_props_creator, template_creator, pdf_config_creator) ⇒ SubnavGenerator

Returns a new instance of SubnavGenerator.



4
5
6
7
8
# File 'lib/bookbinder/subnav/subnav_generator.rb', line 4

def initialize(json_props_creator, template_creator, pdf_config_creator)
  @json_props_creator = json_props_creator
  @template_creator = template_creator
  @pdf_config_creator = pdf_config_creator
end

Instance Attribute Details

#json_props_creatorObject (readonly)

Returns the value of attribute json_props_creator.



16
17
18
# File 'lib/bookbinder/subnav/subnav_generator.rb', line 16

def json_props_creator
  @json_props_creator
end

#pdf_config_creatorObject (readonly)

Returns the value of attribute pdf_config_creator.



16
17
18
# File 'lib/bookbinder/subnav/subnav_generator.rb', line 16

def pdf_config_creator
  @pdf_config_creator
end

#template_creatorObject (readonly)

Returns the value of attribute template_creator.



16
17
18
# File 'lib/bookbinder/subnav/subnav_generator.rb', line 16

def template_creator
  @template_creator
end

Instance Method Details

#generate(subnav_spec) ⇒ Object



10
11
12
13
14
# File 'lib/bookbinder/subnav/subnav_generator.rb', line 10

def generate(subnav_spec)
  filename = json_props_creator.create(subnav_spec)
  template_creator.create(filename, subnav_spec)
  pdf_config_creator.create(filename, subnav_spec) if pdf?(subnav_spec)
end