Sha256: cfe97a08f1819b6e231375b26d38b544d768adc7e76d26da69dba6742a3ad870

Contents?: true

Size: 592 Bytes

Versions: 4

Compression:

Stored size: 592 Bytes

Contents

class Rollin::Article
  attr_reader :year, :month, :day

  def initialize(source_file)
    @source_file = source_file
    filename = File.basename(@source_file)
    @year = filename[0, 4].to_i
    @month = filename[5, 2].to_i
    @day = filename[8, 2].to_i
  end

  def date
    Date.new(@year, @month, @day)
  end

  def body
    redcarpet = Redcarpet::Markdown.new(Redcarpet::Render::HTML,
                            autolink: true,
                            space_after_headers: true,
                            hard_wrap: true)
    redcarpet.render(File.read(@source_file))
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rollin-0.0.10 lib/rollin/article.rb
rollin-0.0.8 lib/rollin/article.rb
rollin-0.0.7 lib/rollin/article.rb
rollin-0.0.6 lib/rollin/article.rb