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.28.0 lib/avo/hosts/base_host.rb
avo-2.27.2.pre.pr1606 lib/avo/hosts/base_host.rb
avo-2.27.1 lib/avo/hosts/base_host.rb
avo-2.27.0 lib/avo/hosts/base_host.rb
avo-2.26.3.pre.pr1601 lib/avo/hosts/base_host.rb
avo-2.26.2.pre.pr1579 lib/avo/hosts/base_host.rb
avo-2.26.1.pr1584.pre.1 lib/avo/hosts/base_host.rb
avo-2.25.1.pre.1.pr1579 lib/avo/hosts/base_host.rb
avo-2.26.0 lib/avo/hosts/base_host.rb
avo-2.25.0 lib/avo/hosts/base_host.rb
avo-2.24.1 lib/avo/hosts/base_host.rb
avo-2.24.0 lib/avo/hosts/base_host.rb
avo-2.23.3.pre.1.pr1529 lib/avo/hosts/base_host.rb
avo-2.23.2 lib/avo/hosts/base_host.rb
avo-2.23.1 lib/avo/hosts/base_host.rb
avo-2.23.0 lib/avo/hosts/base_host.rb
avo-2.22.0 lib/avo/hosts/base_host.rb
avo-2.21.3.pre.pr1489 lib/avo/hosts/base_host.rb
avo-2.21.2.pre.pr1486 lib/avo/hosts/base_host.rb
avo-2.21.1.pre.pr1484 lib/avo/hosts/base_host.rb