Module: Lims::Core::Actions::BulkAction

Defined in:
lib/lims-core/actions/bulk_action.rb

Overview

Lift an action to a bulk one by creating a group of similar actions. The parameters being a array of parameters which will be used to create each individual action.

Defined Under Namespace

Modules: AfterEval

Class Method Summary (collapse)

Class Method Details

+ (Object) included(klass)



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/lims-core/actions/bulk_action.rb', line 10

def self.included(klass) 
  klass.instance_eval  do
    # @param [String] element_name name of the underlying action. Use to get the result from the subaction element.
    # @param [String] parameters key to get parameters array for each action and return the result.
    def initialize_class(element_name, group_name, action_class)
      define_method :group_name do
        group_name
      end

      define_method :action_class do
        action_class
      end

      define_method :element_name do
        element_name
      end

      self.class_eval do
        include ActionGroup
        attribute group_name, Array, :required => true
        include AfterEval
      end
    end
  end
end