Class: Wst::MdContent

Inherits:
Content show all
Defined in:
lib/md_content.rb

Direct Known Subclasses

MdPage, Post

Constant Summary collapse

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Content

#account, #account?, #child, #content, #datas, #dir, #gravatar, #gravatar?, #method_missing, #url, #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) ⇒ MdContent

Returns a new instance of MdContent.



9
10
11
12
13
14
15
16
17
# File 'lib/md_content.rb', line 9

def initialize file_path
  super file_path

  m, cats, date, slug, ext = *file_path.match(@@matcher)
  @cats = cats
  @date = Time.parse(date) if date
  @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



31
32
33
# File 'lib/md_content.rb', line 31

def self.matcher
  @@matcher
end

Instance Method Details

#dateObject



19
20
21
# File 'lib/md_content.rb', line 19

def date
  @date
end

#raw_contentObject



23
24
25
26
27
28
29
# File 'lib/md_content.rb', line 23

def raw_content
  if useDefaultLinks?
    content_with_links
  else
    @plain_content
  end
end