Class: Aircana::Contexts::Local

Inherits:
Object
  • Object
show all
Defined in:
lib/aircana/contexts/local.rb

Instance Method Summary collapse

Instance Method Details

#store_content(title:, content:, kb_name:, kb_type: "local") ⇒ Object

rubocop:disable Lint/UnusedMethodArgument



8
9
10
11
12
13
14
15
16
17
# File 'lib/aircana/contexts/local.rb', line 8

def store_content(title:, content:, kb_name:, kb_type: "local") # rubocop:disable Lint/UnusedMethodArgument
  kb_dir = create_kb_dir(kb_name)
  filename = sanitize_filename(title)
  filepath = File.join(kb_dir, "#{filename}.md")

  File.write(filepath, content)
  Aircana.human_logger.success "Stored '#{title}' for KB '#{kb_name}' at #{filepath}"

  filepath
end