Class: Wikisys::Pages

Inherits:
Object
  • Object
show all
Defined in:
lib/wikisys.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filepath = '.', debug: false) ⇒ Pages

Returns a new instance of Pages.



305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
# File 'lib/wikisys.rb', line 305

def initialize(filepath='.', debug: false)
  
  @filepath, @debug = filepath, debug
  
  entries_file = File.join(@filepath, 'entries.txt')
  
  if File.exists?(entries_file) then
    @entries = DxLite.new(entries_file)
  else
    @entries = DxLite.new('entries/entry(title, tags)')
    @entries.save entries_file
  end

  # check for the mindwords raw document file
  mindwords_file = File.join(@filepath, 'mindwords.txt')
  
  if File.exists?(mindwords_file) then 
    @mw = MindWords.new(mindwords_file)
  else
    @mw = MindWords.new
    @mw.filepath = mindwords_file
  end
  
  @pg = Wiki.new @filepath, entries: @entries, debug: @debug
  
  #scan_md_files()
  
end

Instance Attribute Details

#entriesObject

Returns the value of attribute entries.



303
304
305
# File 'lib/wikisys.rb', line 303

def entries
  @entries
end

#mwObject

Returns the value of attribute mw.



303
304
305
# File 'lib/wikisys.rb', line 303

def mw
  @mw
end

Instance Method Details

#new_pg(filename) ⇒ Object



334
335
336
337
338
339
# File 'lib/wikisys.rb', line 334

def new_pg(filename)
  
  @pg.new_build(filename)
  update_mw(@pg.title, @pg.tags)
  
end

#update_pg(filename) ⇒ Object



341
342
343
344
345
346
# File 'lib/wikisys.rb', line 341

def update_pg(filename)
  
  @pg.modify_build(filename)
  update_mw(@pg.title, @pg.tags)
  
end