Sha256: 3b0047e61c38ca76a6e2524c047f45fd9a69a85381c3d5fbbe6b79ee500b1ba1

Contents?: true

Size: 531 Bytes

Versions: 14

Compression:

Stored size: 531 Bytes

Contents

# WIP
module Blocks
  class InvalidPermissionsHandler
    LOG = :log
    RAISE = :raise

    def self.build(method_name, block_name)
      message = "Cannot #{method_name} #{block_name}; #{block_name} is not in the permitted_blocks list"
      new(message)
      nil
    end

    def initialize(message)
      send("handle_#{Blocks.invalid_permissions_approach}", message)
    end

    private

    def handle_log(message)
      Rails.logger.info message
    end

    def handle_raise(message)
      raise message
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
blocks-3.0.4 lib/blocks/experimental/invalid_permissions_handler.rb
blocks-3.0.3 lib/blocks/experimental/invalid_permissions_handler.rb
blocks-3.0.2 lib/blocks/experimental/invalid_permissions_handler.rb
blocks-3.0.1 lib/blocks/experimental/invalid_permissions_handler.rb
blocks-3.0.0 lib/blocks/experimental/invalid_permissions_handler.rb
blocks-3.0.0.rc9 lib/blocks/experimental/invalid_permissions_handler.rb
blocks-3.0.0.rc8 lib/blocks/experimental/invalid_permissions_handler.rb
blocks-3.0.0.rc7 lib/blocks/experimental/invalid_permissions_handler.rb
blocks-3.0.0.rc6 lib/blocks/experimental/invalid_permissions_handler.rb
blocks-3.0.0.rc5 lib/blocks/experimental/invalid_permissions_handler.rb
blocks-3.0.0.rc4 lib/blocks/experimental/invalid_permissions_handler.rb
blocks-3.0.0.rc3 lib/blocks/experimental/invalid_permissions_handler.rb
blocks-3.0.0.rc2 lib/blocks/experimental/invalid_permissions_handler.rb
blocks-3.0.0.rc1 lib/blocks/experimental/invalid_permissions_handler.rb