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.5.0.rc0 lib/locomotive/steam/liquid/drops/content_types.rb
locomotivecms_steam-1.5.0.beta3 lib/locomotive/steam/liquid/drops/content_types.rb
locomotivecms_steam-1.5.0.beta2 lib/locomotive/steam/liquid/drops/content_types.rb
locomotivecms_steam-1.5.0.beta1 lib/locomotive/steam/liquid/drops/content_types.rb
locomotivecms_steam-1.4.1 lib/locomotive/steam/liquid/drops/content_types.rb
locomotivecms_steam-1.4.0 lib/locomotive/steam/liquid/drops/content_types.rb
locomotivecms_steam-1.4.0.rc2 lib/locomotive/steam/liquid/drops/content_types.rb
locomotivecms_steam-1.4.0.rc1 lib/locomotive/steam/liquid/drops/content_types.rb
locomotivecms_steam-1.4.0.pre.rc.1 lib/locomotive/steam/liquid/drops/content_types.rb
locomotivecms_steam-1.3.0 lib/locomotive/steam/liquid/drops/content_types.rb
locomotivecms_steam-1.3.0.rc2 lib/locomotive/steam/liquid/drops/content_types.rb
locomotivecms_steam-1.1.2 lib/locomotive/steam/liquid/drops/content_types.rb
locomotivecms_steam-1.2.1 lib/locomotive/steam/liquid/drops/content_types.rb
locomotivecms_steam-1.3.0.rc1 lib/locomotive/steam/liquid/drops/content_types.rb
locomotivecms_steam-1.2.0 lib/locomotive/steam/liquid/drops/content_types.rb
locomotivecms_steam-1.2.0.rc3 lib/locomotive/steam/liquid/drops/content_types.rb
locomotivecms_steam-1.2.0.rc2 lib/locomotive/steam/liquid/drops/content_types.rb
locomotivecms_steam-1.2.0.rc1 lib/locomotive/steam/liquid/drops/content_types.rb
locomotivecms_steam-1.2.0.beta1 lib/locomotive/steam/liquid/drops/content_types.rb
locomotivecms_steam-1.1.1 lib/locomotive/steam/liquid/drops/content_types.rb