Sha256: 9470809b93ce3288e3cf03ff67f59bad034570acd9caa89ff501f34019491ad5

Contents?: true

Size: 726 Bytes

Versions: 69

Compression:

Stored size: 726 Bytes

Contents

require "dry-initializer"

# This object holds some data that is usually needed to compute blocks around the app.
module Avo
  module Hosts
    class BaseHost
      extend Dry::Initializer

      option :context, default: proc { Avo::App.context }
      option :params, default: proc { Avo::App.params }
      option :view_context, default: proc { Avo::App.view_context }
      option :current_user, default: proc { Avo::App.current_user }
      # This is optional because we might instantiate the `Host` first and later hydrate it with a block.
      option :block, optional: true

      delegate :authorize, to: Avo::Services::AuthorizationService

      def handle
        instance_exec(&block)
      end
    end
  end
end

Version data entries

69 entries across 69 versions & 1 rubygems

Version Path
avo-2.13.3.pre.4 lib/avo/hosts/base_host.rb
avo-2.13.3.pre.3 lib/avo/hosts/base_host.rb
avo-2.13.3.pre.2 lib/avo/hosts/base_host.rb
avo-2.13.3.pre.1 lib/avo/hosts/base_host.rb
avo-2.13.2.pre.2 lib/avo/hosts/base_host.rb
avo-2.13.2.pre.1 lib/avo/hosts/base_host.rb
avo-2.13.1 lib/avo/hosts/base_host.rb
avo-2.13.0 lib/avo/hosts/base_host.rb
avo-2.12.1.pre.1 lib/avo/hosts/base_host.rb