Class: Bookbinder::Subnav::JsonPropsCreator

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fs, output_locations, json_generator) ⇒ JsonPropsCreator

Returns a new instance of JsonPropsCreator.



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

def initialize(fs, output_locations, json_generator)
  @fs = fs
  @output_locations = output_locations
  @json_generator = json_generator
end

Instance Attribute Details

#fsObject (readonly)

Returns the value of attribute fs.



18
19
20
# File 'lib/bookbinder/subnav/json_props_creator.rb', line 18

def fs
  @fs
end

#json_generatorObject (readonly)

Returns the value of attribute json_generator.



18
19
20
# File 'lib/bookbinder/subnav/json_props_creator.rb', line 18

def json_generator
  @json_generator
end

#output_locationsObject (readonly)

Returns the value of attribute output_locations.



18
19
20
# File 'lib/bookbinder/subnav/json_props_creator.rb', line 18

def output_locations
  @output_locations
end

Instance Method Details

#create(subnav_spec) ⇒ Object



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

def create(subnav_spec)
  json_links = json_generator.get_links(subnav_spec, output_locations)

  fs.write(text: json_links, to: props_path(subnav_spec.subnav_name))

  filename(subnav_spec.subnav_name)
end