Class: Cloudpress::Renderers::Archives

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudpress/renderers/archives.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context, archives) ⇒ Archives

Returns a new instance of Archives.



7
8
9
10
# File 'lib/cloudpress/renderers/archives.rb', line 7

def initialize(context, archives)
  @context  = context
  @archives = archives
end

Instance Attribute Details

#archivesObject (readonly)

Returns the value of attribute archives.



5
6
7
# File 'lib/cloudpress/renderers/archives.rb', line 5

def archives
  @archives
end

Instance Method Details

#renderObject



16
17
18
19
20
21
22
# File 'lib/cloudpress/renderers/archives.rb', line 16

def render
  @context.render(layout: 'cloudpress/archives/archives', locals: {renderer: self}) do
    @context.(:ul) do
      wrapped_archives.map(&:render).join("\n").html_safe
    end
  end
end

#wrapped_archivesObject



12
13
14
# File 'lib/cloudpress/renderers/archives.rb', line 12

def wrapped_archives
  @wrapped_archives ||= archives.map {|archive| Cloudpress::Renderers::Archive.new(@context, archive)}
end