Sha256: bf9c62d124de8ef63f2ebcb9661b0bd62f48dfc44e778b5e27ada84edcdf3fd6

Contents?: true

Size: 804 Bytes

Versions: 5

Compression:

Stored size: 804 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 template
      ERB.new(File.read(template)).result(binding)
    end
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
baron-1.0.20 lib/baron/page_controller.rb
baron-1.0.18 lib/baron/page_controller.rb
baron-1.0.17 lib/baron/page_controller.rb
baron-1.0.14 lib/baron/page_controller.rb
baron-1.0.13 lib/baron/page_controller.rb