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 = path
  @type = type
end

Public Instance Methods

dir?() click to toggle source
# File lib/madness/item.rb, line 24
def dir?
  type == :dir
end
file?() click to toggle source
# File lib/madness/item.rb, line 28
def file?
  type == :file
end
href() click to toggle source
# File lib/madness/item.rb, line 17
def href
  @href ||= begin
    result = path_without_extension.sub(/^#{docroot}/, '').to_href
    "#{config.base_uri}#{result}"
  end
end
label() click to toggle source
# File lib/madness/item.rb, line 13
def label
  @label ||= label!
end

Private Instance Methods

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