Sha256: 36ac91ea8d842b149606eb70dbfe6c5026d014fe7b2dcc69176d6077d8e81f21

Contents?: true

Size: 446 Bytes

Versions: 26

Compression:

Stored size: 446 Bytes

Contents

module AngularSprinkles
  class ContentYielder
    def initialize(args)
      @context = args.fetch(:context)
      @yield_to = args.fetch(:yield_to)
      @cache = args.fetch(:cache)
    end

    def call(content)
      return '' if @cache.set?(content)

      @cache.set(content)

      @context.content_tag(:script, content.to_json.html_safe).tap do |script_tag|
        @context.content_for(@yield_to, script_tag)
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
angular_sprinkles-0.3.3 lib/angular_sprinkles/content_yielder.rb
angular_sprinkles-0.3.2 lib/angular_sprinkles/content_yielder.rb
angular_sprinkles-0.3.1 lib/angular_sprinkles/content_yielder.rb
angular_sprinkles-0.3.0 lib/angular_sprinkles/content_yielder.rb
angular_sprinkles-0.2.14 lib/angular_sprinkles/content_yielder.rb
angular_sprinkles-0.2.13 lib/angular_sprinkles/content_yielder.rb
angular_sprinkles-0.2.12 lib/angular_sprinkles/content_yielder.rb
angular_sprinkles-0.2.11 lib/angular_sprinkles/content_yielder.rb
angular_sprinkles-0.2.10 lib/angular_sprinkles/content_yielder.rb
angular_sprinkles-0.2.9 lib/angular_sprinkles/content_yielder.rb
angular_sprinkles-0.2.8 lib/angular_sprinkles/content_yielder.rb
angular_sprinkles-0.2.7 lib/angular_sprinkles/content_yielder.rb
angular_sprinkles-0.2.6 lib/angular_sprinkles/content_yielder.rb
angular_sprinkles-0.2.5 lib/angular_sprinkles/content_yielder.rb
angular_sprinkles-0.2.4 lib/angular_sprinkles/content_yielder.rb
angular_sprinkles-0.2.3 lib/angular_sprinkles/content_yielder.rb
angular_sprinkles-0.2.2 lib/angular_sprinkles/content_yielder.rb
angular_sprinkles-0.2.1 lib/angular_sprinkles/content_yielder.rb
angular_sprinkles-0.2.0 lib/angular_sprinkles/content_yielder.rb
angular_sprinkles-0.1.1 lib/angular_sprinkles/content_yielder.rb