Class: SearchDocTree

Inherits:
Object
  • Object
show all
Defined in:
lib/giblish-search.rb

Instance Method Summary collapse

Constructor Details

#initialize(input_data) ⇒ SearchDocTree

Returns a new instance of SearchDocTree.



195
196
197
# File 'lib/giblish-search.rb', line 195

def initialize(input_data)
  @input_data = input_data
end

Instance Method Details

#searchObject



199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# File 'lib/giblish-search.rb', line 199

def search
  # read the heading_db from file
  jsonpath = @input_data[:search_top].join("heading_index.json")
  src_index = {}
  json = File.read(jsonpath.to_s)
  src_index = JSON.parse(json)

  # search the doc tree for regex
  gt = GrepDocTree.new @input_data
  gt.grep

  matches = gt.match_with_headings src_index

  format_search_adoc matches, get_uri_top
end