# frozen_string_literal: true module Blacklight # Dynamically creates methods on the given controller (typically CatalogController) # for handling configured show tools class ActionBuilder # @param [Object] klass # @param [String] name # @param [Hash] opts # @option opts [Symbol] callback # @option opts [Symbol] validator # @option opts [Boolean] define_method def initialize(klass, name, opts) @klass = klass @name = name @opts = opts end attr_reader :klass, :name, :opts # Define a simple action handler for the tool as long as the method # doesn't already exist or the `:define_method` option is not `false` def build # rubocop:disable Metrics/MethodLength return if skip? callback = opts.fetch(:callback, nil).inspect validator = opts.fetch(:validator, nil).inspect klass.class_eval <