Class: Diary::Item::Base

Inherits:
Object
  • Object
show all
Extended by:
Creator, Finder
Defined in:
lib/diary/item/base.rb

Direct Known Subclasses

Page, Post

Constant Summary

Constants included from Creator

Creator::ACCENTS

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Creator

create, extended

Methods included from Finder

all, find, first, last

Constructor Details

#initialize(path) ⇒ Base

Returns a new instance of Base.



6
7
8
# File 'lib/diary/item/base.rb', line 6

def initialize(path)
  @path = path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



4
5
6
# File 'lib/diary/item/base.rb', line 4

def path
  @path
end

Class Method Details

.base_directoryObject



18
19
20
# File 'lib/diary/item/base.rb', line 18

def self.base_directory
  self.name.downcase.pluralize
end

Instance Method Details

#basenameObject



10
11
12
# File 'lib/diary/item/base.rb', line 10

def basename
  File.basename(path, '.md')
end

#classnameObject



14
15
16
# File 'lib/diary/item/base.rb', line 14

def classname
  self.class.name.downcase
end