Sha256: b886a403c62578ac545c7dd314de50c7fa2a90b6e4ac5d37b00ffaf682696300

Contents?: true

Size: 661 Bytes

Versions: 1

Compression:

Stored size: 661 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

        def view_key(name)
          "views.#{name}"
        end
      end

      module RequestMethods
        def view(name, options = {})
          options = {context: scope.view_context}.merge(options)
          on to: scope.view_key(name), call_with: [options]
        end
      end
    end

    register_plugin :dry_view, DryView
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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