Class: Architext::Obsidian
- Inherits:
-
Object
- Object
- Architext::Obsidian
show all
- Defined in:
- lib/architext/obsidian.rb
Defined Under Namespace
Classes: CommandFailed, CommandNotFound
Instance Method Summary
collapse
Constructor Details
#initialize(vault: nil, executable: ENV.fetch('ARCHITEXT_OBSIDIAN', 'obsidian')) ⇒ Obsidian
Returns a new instance of Obsidian.
13
14
15
16
|
# File 'lib/architext/obsidian.rb', line 13
def initialize(vault: nil, executable: ENV.fetch('ARCHITEXT_OBSIDIAN', 'obsidian'))
@vault = vault
@executable = executable
end
|
Instance Method Details
#read(path) ⇒ Object
27
28
29
|
# File 'lib/architext/obsidian.rb', line 27
def read(path)
run('read', "path=#{path}")
end
|
#search(query) ⇒ Object
18
19
20
21
22
23
24
25
|
# File 'lib/architext/obsidian.rb', line 18
def search(query)
json_output = run('search', "query=#{query}", 'format=json')
json_paths = SearchResults.parse(json_output)
return json_paths unless json_paths.empty?
text_output = run('search', "query=#{query}", 'format=text')
SearchResults.parse(text_output)
end
|
#vault_info ⇒ Object
35
36
37
|
# File 'lib/architext/obsidian.rb', line 35
def vault_info
run('vault').to_s
end
|
#version ⇒ Object
31
32
33
|
# File 'lib/architext/obsidian.rb', line 31
def version
run('version').to_s.strip
end
|