Sha256: 27617c58b4278742176b41a3d7127480734c5acb4736ec26dbb14fe6e84b700e

Contents?: true

Size: 590 Bytes

Versions: 2

Compression:

Stored size: 590 Bytes

Contents

class Roda
  module RodaPlugins
    module DryView
      def self.load_dependencies(app)
        app.plugin :flow
      end

      module InstanceMethods
        def view_context
          self.class["view.context"].with(view_context_options)
        end

        def view_context_options
          {}
        end
      end

      module RequestMethods
        def view(name, options = {})
          options = {context: scope.view_context}.merge(options)
          is to: "views.#{name}", call_with: [options]
        end
      end
    end

    register_plugin :dry_view, DryView
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dry-web-roda-0.9.1 lib/roda/plugins/dry_view.rb
dry-web-roda-0.9.0 lib/roda/plugins/dry_view.rb