class Mintaka::Page

Attributes

content_path[R]
file_path[R]

Public Class Methods

new(content_path, file_path) click to toggle source
# File lib/mintaka/page.rb, line 5
def initialize(content_path, file_path)
  @content_path = content_path
  @file_path = file_path
end

Public Instance Methods

id() click to toggle source
# File lib/mintaka/page.rb, line 10
def id
  file_path.gsub(content_path, "").gsub(html_file_pattern, "")
end
valid?() click to toggle source
# File lib/mintaka/page.rb, line 14
def valid?
  exists? && file_in_content_path? && !directory? && !partial? && html?
end

Private Instance Methods

directory?() click to toggle source
# File lib/mintaka/page.rb, line 28
def directory?
  FileTest.directory?(file_path)
end
exists?() click to toggle source
# File lib/mintaka/page.rb, line 20
def exists?
  File.exists?(file_path)
end
file_in_content_path?() click to toggle source
# File lib/mintaka/page.rb, line 24
def file_in_content_path?
  file_path.start_with?(content_path)
end
html?() click to toggle source
# File lib/mintaka/page.rb, line 36
def html?
  !file_path.match(html_file_pattern).nil?
end
html_file_pattern() click to toggle source
# File lib/mintaka/page.rb, line 40
def html_file_pattern
  /\.(html)(\.[a-z]+)?$/
end
partial?() click to toggle source
# File lib/mintaka/page.rb, line 32
def partial?
  File.basename(file_path).first == "_"
end