Sha256: c4eef09d3ee5a6e22b6c5e9084445b42b44414d4be7ae9f8bd18395f75a71c2a

Contents?: true

Size: 757 Bytes

Versions: 34

Compression:

Stored size: 757 Bytes

Contents

module Locomotive
  module Steam
    module Liquid
      module Drops
        class ContentTypes < ::Liquid::Drop

          def before_method(meth)
            if content_type = fetch_content_type(meth.to_s)
              ContentEntryCollection.new(content_type)
            else
              nil
            end
          end

          private

          def repository
            @context.registers[:services].repositories.content_type
          end

          def fetch_content_type(slug)
            @content_type_map ||= {}

            if !@content_type_map.include?(slug)
              @content_type_map[slug] = repository.by_slug(slug)
            end

            @content_type_map[slug]
          end

        end

      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
locomotivecms_steam-1.1.0 lib/locomotive/steam/liquid/drops/content_types.rb
locomotivecms_steam-1.1.0.rc3 lib/locomotive/steam/liquid/drops/content_types.rb
locomotivecms_steam-1.1.0.rc2 lib/locomotive/steam/liquid/drops/content_types.rb
locomotivecms_steam-1.1.0.rc1 lib/locomotive/steam/liquid/drops/content_types.rb
locomotivecms_steam-1.0.1 lib/locomotive/steam/liquid/drops/content_types.rb
locomotivecms_steam-1.0.0 lib/locomotive/steam/liquid/drops/content_types.rb
locomotivecms_steam-1.0.0.rc10 lib/locomotive/steam/liquid/drops/content_types.rb
locomotivecms_steam-1.0.0.rc9 lib/locomotive/steam/liquid/drops/content_types.rb
locomotivecms_steam-1.0.0.rc8 lib/locomotive/steam/liquid/drops/content_types.rb
locomotivecms_steam-1.0.0.rc6 lib/locomotive/steam/liquid/drops/content_types.rb
locomotivecms_steam-1.0.0.rc4 lib/locomotive/steam/liquid/drops/content_types.rb
locomotivecms_steam-1.0.0.rc3 lib/locomotive/steam/liquid/drops/content_types.rb
locomotivecms_steam-1.0.0.rc2 lib/locomotive/steam/liquid/drops/content_types.rb
locomotivecms_steam-1.0.0.rc1 lib/locomotive/steam/liquid/drops/content_types.rb