class Madman::Item

Attributes

basedir[R]
path[R]
type[R]

Public Class Methods

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

Public Instance Methods

dir?() click to toggle source
# File lib/madman/item.rb, line 19
def dir?
  type == :dir
end
file?() click to toggle source
# File lib/madman/item.rb, line 23
def file?
  type == :file
end
href() click to toggle source
# File lib/madman/item.rb, line 15
def href
  Addressable::URI.escape(path_without_extension.sub(/^#{basedir}\//, ''))
end
label() click to toggle source
# File lib/madman/item.rb, line 11
def label
  @label ||= File.basename(path_without_extension)
end

Private Instance Methods

path_without_extension() click to toggle source
# File lib/madman/item.rb, line 29
def path_without_extension
  @path_without_extension ||= path.sub(/\.md$/, '')
end