Sha256: 670c94308b988bf2552a366bfaf0f3308999908dfbb0673f869979ff688fa0fd

Contents?: true

Size: 543 Bytes

Versions: 2

Compression:

Stored size: 543 Bytes

Contents

require 'liquid'
module Spud
  module Cms
    class LiquidSnippet < Liquid::Tag
      def initialize(_tag_name, snippet_name, _tokens)
        @snippet_name = snippet_name
        @snippet = SpudSnippet.where(name: snippet_name).first
      end

      def tag_name
        return 'snippet'
      end

      def tag_value
        return @snippet_name
      end

      def render(_context)
        if !@snippet.blank?
          return @snippet.content_processed.html_safe
        else
          return ''
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tb_cms-1.3.0 lib/spud_cms/liquid_snippet.rb
tb_cms-1.3.beta1 lib/spud_cms/liquid_snippet.rb