Class: Ncn::NotePathBuilder

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(created:, id:) ⇒ NotePathBuilder

Returns a new instance of NotePathBuilder.



5
6
7
8
# File 'lib/ncn/note_path_builder.rb', line 5

def initialize(created:, id:)
  @id = id
  @created = created
end

Instance Attribute Details

#createdObject (readonly)

Returns the value of attribute created.



3
4
5
# File 'lib/ncn/note_path_builder.rb', line 3

def created
  @created
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/ncn/note_path_builder.rb', line 3

def id
  @id
end

Instance Method Details

#directory_namesObject



14
15
16
# File 'lib/ncn/note_path_builder.rb', line 14

def directory_names
  [year, month, day]
end

#pathObject



10
11
12
# File 'lib/ncn/note_path_builder.rb', line 10

def path
  File.join(*directory_names, "#{id}.md")
end