Sha256: 2f72bb4e223c6fe956240d660eb67fe226f9d4a72dfd7129ba233e6a22bda977
Contents?: true
Size: 673 Bytes
Versions: 1
Compression:
Stored size: 673 Bytes
Contents
module TypeStation class ContentPresenter < BasePresenter presents :content def value content.get end def call(&block) case content.type when :image, :file block.call(OpenStruct.new(content.get)) when :multiple_select block.call(content.get) when :html content.get.html_safe else content.get end.to_s end private def image_struct OpenStruct.new({url: content.get, alt: ''}) end def image_struct OpenStruct.new({url: '', alt: ''}) end def select_struct OpenStruct.new({value: content.get, values: content.get }) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
type_station-0.0.1.pre | app/presenters/type_station/content_presenter.rb |