Class: Lifer::URIStrategy::Pretty

Inherits:
Base
  • Object
show all
Defined in:
lib/lifer/uri_strategy/pretty.rb

Instance Attribute Summary

Attributes inherited from Base

#root

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Lifer::URIStrategy::Base

Instance Method Details

#nameObject



2
3
4
# File 'lib/lifer/uri_strategy/pretty.rb', line 2

def name
  "pretty"
end

#output_file(entry) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/lifer/uri_strategy/pretty.rb', line 6

def output_file(entry)
  basename = File.basename(entry.file, ".*")

  Pathname entry.file.to_s
    .gsub(/#{root}[\/]{0,1}/, "")
    .gsub(/#{basename}(\..+)/, "#{basename}/index.html")
end