Class: Marti::Marticle

Inherits:
Object
  • Object
show all
Defined in:
app/models/marti/marticle.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



3
4
5
# File 'app/models/marti/marticle.rb', line 3

def content
  @content
end

#extractObject (readonly)

Returns the value of attribute extract.



3
4
5
# File 'app/models/marti/marticle.rb', line 3

def extract
  @extract
end

#last_updated_atObject (readonly)

Returns the value of attribute last_updated_at.



3
4
5
# File 'app/models/marti/marticle.rb', line 3

def last_updated_at
  @last_updated_at
end

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'app/models/marti/marticle.rb', line 3

def path
  @path
end

Class Method Details

.articlesObject



5
6
7
8
9
10
11
12
13
# File 'app/models/marti/marticle.rb', line 5

def self.articles
  articles = []
  Dir[File.join(Marti.article_directory, "*.md")].each do |file|
    path = file.gsub(/^.*\//, "").gsub(/\.md/, "")
    articles << Marti::MarticleBuilder.new(path).build
  end
  articles.sort_by(&:last_updated_at)
  articles
end