Sha256: fad16d4e5bac54118bfb76cba652c06096fc5dedad6e8efd263333a1e6d12b40

Contents?: true

Size: 501 Bytes

Versions: 6

Compression:

Stored size: 501 Bytes

Contents

require "dry/view/context"

module <%= application_module %>
  module Web
    module View
      class Context < Dry::View::Context
        def assets
          self[:assets]
        end

        def csrf_token
          self[:csrf_token]
        end

        def flash
          self[:flash]
        end

        def flash?
          %i[notice alert].any? { |type| flash[type] }
        end

        private

        def [](name)
          _options.fetch(name)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
snowpack-1.0.0.alpha7 lib/snowpack/generators/application/templates/lib/__application_path__/web/view/context.rb.tt
snowpack-1.0.0.alpha6 lib/snowpack/generators/application/templates/lib/__application_path__/web/view/context.rb.tt
snowpack-1.0.0.alpha5 lib/snowpack/generators/application/templates/lib/__application_path__/web/view/context.rb.tt
snowpack-1.0.0.alpha4 lib/snowpack/generators/application/templates/lib/__application_path__/web/view/context.rb.tt
snowpack-1.0.0.alpha3 lib/snowpack/generators/application/templates/lib/__application_path__/web/view/context.rb.tt
snowpack-1.0.0.alpha2 lib/snowpack/generators/application/templates/lib/__application_path__/web/view/context.rb.tt