Sha256: 7928b07922cda7604d2b164e9e3954faf3f87dca2a367a661dfc1b0001780a58

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)
          is 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.10.0 lib/roda/plugins/dry_view.rb