Sha256: f971f905f95fda52a34dd228a9e878a509e231f03526f71d2ad5fede65dfac5a

Contents?: true

Size: 413 Bytes

Versions: 11

Compression:

Stored size: 413 Bytes

Contents

module Hicube
  module Liquid
    module Tags
      class UrlTag < ::Liquid::Tag

        def initialize(tag_name, name, tokens)
          super
          @doc = Hicube::Document.find_by(name: name)
        rescue
        end

        def render(context)
          @doc.nil? ? "document_not_found" : @doc.file_url
        end
      end

      ::Liquid::Template.register_tag('url_tag', UrlTag)

    end
  end
end 

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
hicube-0.0.11 lib/hicube/liquid/tags/url.rb
hicube-0.0.10 lib/hicube/liquid/tags/url.rb
hicube-0.0.9 lib/hicube/liquid/tags/url.rb
hicube-0.0.8 lib/hicube/liquid/tags/url.rb
hicube-0.0.7 lib/hicube/liquid/tags/url.rb
hicube-0.0.6 lib/hicube/liquid/tags/url.rb
hicube-0.0.5 lib/hicube/liquid/tags/url.rb
hicube-0.0.4 lib/hicube/liquid/tags/url.rb
hicube-0.0.3 lib/hicube/liquid/tags/url.rb
hicube-0.0.2 lib/hicube/liquid/tags/url.rb
hicube-0.0.1 lib/hicube/liquid/tags/url.rb