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.21.0 lib/avo/hosts/base_host.rb
avo-2.21.1.pre.pr1476 lib/avo/hosts/base_host.rb
avo-2.21.1.pre.issue1450 lib/avo/hosts/base_host.rb
avo-2.21.1.pre.issue1444 lib/avo/hosts/base_host.rb
avo-2.20.0 lib/avo/hosts/base_host.rb
avo-2.19.0 lib/avo/hosts/base_host.rb
avo-2.18.1 lib/avo/hosts/base_host.rb
avo-2.18.1.pre.1.eagerloaddirs lib/avo/hosts/base_host.rb
avo-2.18.0 lib/avo/hosts/base_host.rb
avo-2.17.1.pre.5.stackedlayout lib/avo/hosts/base_host.rb
avo-2.17.1.pre.4.issue.1342 lib/avo/hosts/base_host.rb
avo-2.17.1.pre.3 lib/avo/hosts/base_host.rb
avo-2.17.1.pre.2.customauthorizationclients lib/avo/hosts/base_host.rb
avo-2.17.1.pre.1.zeitwerk.eager.load.dir lib/avo/hosts/base_host.rb
avo-2.17.0 lib/avo/hosts/base_host.rb
avo-2.16.1.pre.1.nativefields lib/avo/hosts/base_host.rb
avo-2.16.0 lib/avo/hosts/base_host.rb
avo-2.15.3 lib/avo/hosts/base_host.rb
avo-2.15.3.pre.1.data.attrs.to.sidebar.items lib/avo/hosts/base_host.rb
avo-2.15.2 lib/avo/hosts/base_host.rb