Sha256: 0434223d2764a005c3cdc2577c3b6aec3c4410f2f617f75a5444670f30b533b7
Contents?: true
Size: 785 Bytes
Versions: 21
Compression:
Stored size: 785 Bytes
Contents
module Spina module Partable extend ActiveSupport::Concern attr_accessor :view_context included do def part(attributes) part = find_part(attributes[:name]) || attributes[:part_type].constantize.new # Copy all attributes to part %w(name title options).each do |attribute| part.public_send("#{attribute}=", attributes[attribute.to_sym]) if part.respond_to?(attribute) end part end def has_content?(name) find_part(name).present? end def content(name = nil) name ? find_part(name)&.content : content_presenter end private def content_presenter @content_presenter ||= ContentPresenter.new(view_context, self) end end end end
Version data entries
21 entries across 21 versions & 1 rubygems