Sha256: 2b3f8cb8d8147c104421d334a038f584615dad400fa289f6c8ac3df486b6aa95
Contents?: true
Size: 815 Bytes
Versions: 4
Compression:
Stored size: 815 Bytes
Contents
module Landable class PageDecorator include ActionView::Helpers::TagHelper def initialize(page) raise TypeError.new("Use Landable::NullPageDecorator") if page.nil? @page = page end def title content_tag('title', page.title) if page.title? end def path page.path end def page_name page.page_name end def body page.body.try(:html_safe) end def head_content page.head_content.try(:html_safe) end def meta_tags return nil unless page.meta_tags? page.meta_tags.map { |name, value| tag('meta', name: name, content: value) if value.present? }.compact.join("\n").html_safe end private attr_reader :page # Keeping it private until there's a compelling reason not to end end
Version data entries
4 entries across 4 versions & 1 rubygems