Class: Cloudpress::Renderers::Archives
- Inherits:
-
Object
- Object
- Cloudpress::Renderers::Archives
- Defined in:
- lib/cloudpress/renderers/archives.rb
Instance Attribute Summary collapse
-
#archives ⇒ Object
readonly
Returns the value of attribute archives.
Instance Method Summary collapse
-
#initialize(context, archives) ⇒ Archives
constructor
A new instance of Archives.
- #render ⇒ Object
- #wrapped_archives ⇒ Object
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
#archives ⇒ Object (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
#render ⇒ Object
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.content_tag(:ul) do wrapped_archives.map(&:render).join("\n").html_safe end end end |
#wrapped_archives ⇒ Object
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 |