class Madness::Item

Attributes

path[R]
type[R]

Public Class Methods

new(path, type) click to toggle source
# File lib/madness/item.rb, line 8
def initialize(path, type)
  @path, @type = path, type
end

Public Instance Methods

dir?() click to toggle source
# File lib/madness/item.rb, line 20
def dir?
  type == :dir
end
file?() click to toggle source
# File lib/madness/item.rb, line 24
def file?
  type == :file
end
href() click to toggle source
# File lib/madness/item.rb, line 16
def href
  path_without_extension.sub(/^#{docroot}/, '').to_href
end
label() click to toggle source
# File lib/madness/item.rb, line 12
def label
  @label ||= label!
end

Private Instance Methods

label!() click to toggle source
# File lib/madness/item.rb, line 30
def label!
  File.basename(path_without_extension).to_label
end
path_without_extension() click to toggle source
# File lib/madness/item.rb, line 34
def path_without_extension
  @path_without_extension ||= path.sub(/\.md$/, '')
end