Sha256: 7e02a3dd07d011897ff69c5cf3af3256974fc747d897ccd2ff2a9d01d994a5e0

Contents?: true

Size: 808 Bytes

Versions: 2

Compression:

Stored size: 808 Bytes

Contents

module Baron

  class PageController
    def initialize articles_parts, categories, max_articles, params, theme, config
      @categories, @params, @theme, @config = categories, params, theme, config
      stop_at = (:all == max_articles) ? articles_parts.count : max_articles
      @articles = articles_parts.take(stop_at).map { |file_parts| Article.new(file_parts, @config) }
      @article = @articles.first
    end
    
    def render_html partial_template, layout_template
      @content = ERB.new(File.read(partial_template)).result(binding)
      if @content[0..99].include? '<html'
        return @content
      else
        ERB.new(File.read(layout_template)).result(binding)
      end 
    end
    
    def render_rss template
      ERB.new(File.read(template)).result(binding)
    end
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
baron-1.0.12 lib/baron/page_controller.rb
baron-1.0.11 lib/baron/page_controller.rb