Sha256: d5a62baa66994c344395142d00529a4705f18bd80fb9a1d04239732e14b1fd96

Contents?: true

Size: 646 Bytes

Versions: 28

Compression:

Stored size: 646 Bytes

Contents

module Dugway
  module Drops
    class ThemeImageSetsDrop < BaseDrop
      def before_method(method_or_key)
        if source.respond_to?('has_key?') && source.has_key?(method_or_key) && settings_image_sets.find { |image| image['variable'] == method_or_key.to_s }
          source[method_or_key].map { |image| ImageDrop.new(image.stringify_keys) }
        else
          []
        end
      end

      private
      def settings_image_sets
        @settings_image_sets ||= settings.has_key?('image_sets') ? settings['image_sets'] : []
      end

      def settings
        @settings ||= @context.registers[:settings]
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
dugway-0.10.5 lib/dugway/liquid/drops/theme_image_sets_drop.rb
dugway-0.10.4 lib/dugway/liquid/drops/theme_image_sets_drop.rb
dugway-0.10.3 lib/dugway/liquid/drops/theme_image_sets_drop.rb
dugway-0.10.2 lib/dugway/liquid/drops/theme_image_sets_drop.rb
dugway-0.10.1 lib/dugway/liquid/drops/theme_image_sets_drop.rb
dugway-0.10.0 lib/dugway/liquid/drops/theme_image_sets_drop.rb
dugway-0.9.0 lib/dugway/liquid/drops/theme_image_sets_drop.rb
dugway-0.8.4 lib/dugway/liquid/drops/theme_image_sets_drop.rb