Class: ZettelOutline::Archive

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

Instance Method Summary collapse

Constructor Details

#initialize(folder) ⇒ Archive

Returns a new instance of Archive.



12
13
14
# File 'lib/zettel_outline/archive.rb', line 12

def initialize(folder)
  @folder = folder
end

Instance Method Details

#create_zettel(path) ⇒ Object



20
21
22
23
24
# File 'lib/zettel_outline/archive.rb', line 20

def create_zettel(path)
  return NullZettel.new if path.nil?
  
  Zettel.new(path)
end

#path(id, finder = Finder.new) ⇒ Object



26
27
28
# File 'lib/zettel_outline/archive.rb', line 26

def path(id, finder = Finder.new)
  finder.file_path(@folder, id)
end

#zettel(id, finder = Finder.new) ⇒ Object



16
17
18
# File 'lib/zettel_outline/archive.rb', line 16

def zettel(id, finder = Finder.new)
  create_zettel(path(id, finder))
end