Sha256: 3c77bd92821b4d68b2a5c2ac0fc5cbad280161017b0575841c3b001901497113
Contents?: true
Size: 790 Bytes
Versions: 6
Compression:
Stored size: 790 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 hint 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
6 entries across 6 versions & 1 rubygems