Sha256: baa9f94d623f71a2f266f7fac894fb7abb13929c4e8abcb5def4b4ad4b3999f5

Contents?: true

Size: 772 Bytes

Versions: 8

Compression:

Stored size: 772 Bytes

Contents

# frozen_string_literal: true

require 'tilt'

module Lipstick
  module Images
    class Processor < ::Tilt::Template
      class DSL
        def initialize(context)
          @context = context
        end

        # rubocop:disable Security/Eval
        def run(data)
          binding.eval(data)
        end
        # rubocop:enable Security/Eval

        def email_banner(image: 'logo.png', title:, environment:)
          @context.depend_on_asset(image)
          asset = @context.environment.find_asset(image)
          EmailBanner.new(image: asset, title: title, environment: environment)
                     .to_png
        end
      end

      def prepare; end

      def evaluate(context, _locals)
        DSL.new(context).run(data)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
aaf-lipstick-4.2.0 lib/lipstick/images/processor.rb
aaf-lipstick-4.1.0 lib/lipstick/images/processor.rb
aaf-lipstick-4.0.1 lib/lipstick/images/processor.rb
aaf-lipstick-3.2.0 lib/lipstick/images/processor.rb
aaf-lipstick-3.1.0 lib/lipstick/images/processor.rb
aaf-lipstick-3.0.6 lib/lipstick/images/processor.rb
aaf-lipstick-3.0.5 lib/lipstick/images/processor.rb
aaf-lipstick-3.0.4 lib/lipstick/images/processor.rb