Class: Note

Inherits:
FileName show all
Defined in:
lib/models/files/note.rb

Instance Attribute Summary

Attributes inherited from FileName

#dirname, #filename, #path

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from FileName

#extname, #name, #no_dir?

Constructor Details

#initialize(path) ⇒ Note

Returns a new instance of Note.



12
13
14
15
16
17
18
# File 'lib/models/files/note.rb', line 12

def initialize(path)
  super
  unless no_dir?
    @dirname = File.expand_path(@dirname)
    @path = File.expand_path(@path)
  end
end

Class Method Details

.touch(path) ⇒ Object



5
6
7
8
9
10
# File 'lib/models/files/note.rb', line 5

def self.touch(path)
  note = new(path)
  FileUtils.makedirs(note.dirname)
  FileUtils.touch(note.path)
  return note
end