Class: Wst::HamlPage

Inherits:
HamlContent show all
Includes:
PageComparison
Defined in:
lib/page.rb

Constant Summary collapse

@@matcher =
/^(.+\/)*(.*)(\.[^.]+)$/

Class Method Summary collapse

Instance Method Summary collapse

Methods included from PageComparison

#<=>

Methods inherited from HamlContent

#deep_content, #sub_content

Methods inherited from Content

#account, #account?, #child, #content, #datas, #dir, #gravatar, #gravatar?, #method_missing, #raw_content, #url=

Methods included from Configuration

#config, config, #defaultLinks, defaultLinks, links_file_path, read_config, read_configuration, read_default_links, read_translations, translation_files, valid_location?

Constructor Details

#initialize(file_path) ⇒ HamlPage

Returns a new instance of HamlPage.



18
19
20
21
22
23
24
25
26
# File 'lib/page.rb', line 18

def initialize file_path
  super file_path

  m, cats, slug, ext = *file_path.match(@@matcher)
  base_path = File.join(Configuration.config['path'], '_pages') + '/'
  @cats = cats.gsub(base_path, '').chomp('/') if !cats.nil? && cats != base_path
  @slug = slug
  @ext = ext
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Wst::Content

Class Method Details

.matcherObject



32
33
34
# File 'lib/page.rb', line 32

def self.matcher
  @@matcher
end

Instance Method Details

#urlObject



28
29
30
# File 'lib/page.rb', line 28

def url
  "#{@cats + '/' if @cats != ''}#{CGI.escape @slug}.html"
end