Class: Bookbinder::Subnav::JsonFromHtmlToc
- Inherits:
-
Object
- Object
- Bookbinder::Subnav::JsonFromHtmlToc
- Defined in:
- lib/bookbinder/subnav/json_from_html_toc.rb
Instance Method Summary collapse
- #get_links(section, output_locations) ⇒ Object
-
#initialize(fs) ⇒ JsonFromHtmlToc
constructor
A new instance of JsonFromHtmlToc.
Constructor Details
#initialize(fs) ⇒ JsonFromHtmlToc
Returns a new instance of JsonFromHtmlToc.
7 8 9 |
# File 'lib/bookbinder/subnav/json_from_html_toc.rb', line 7 def initialize(fs) @fs = fs end |
Instance Method Details
#get_links(section, output_locations) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/bookbinder/subnav/json_from_html_toc.rb', line 11 def get_links(section, output_locations) @section, @output_locations = section, output_locations doc = parse_toc_file set_anchor_values(doc.css('a')) { links: gather_urls_and_texts(doc.css('body > ul')) }.to_json end |