class DataMiner::Step::Process

A step that executes a single class method on the model or an arbitrary code block.

Create these by calling process inside a data_miner block.

@see DataMiner::ActiveRecordClassMethods#data_miner Overview of how to define data miner scripts inside of ActiveRecord models. @see DataMiner::Script#process Creating a process step by calling DataMiner::Script#process from inside a data miner script

Attributes

blk[R]

The block of arbitrary code to be run. @return [Proc]

block_description[R]

A description of what the block does. Doesn’t exist when a single class method is specified using a Symbol. @return [String]

description[R]

A description of what the block does. Doesn’t exist when a single class method is specified using a Symbol. @return [String]

method_id[R]

The method to be called on the model class. @return [Symbol]

Public Class Methods

new(script, method_id_or_description, ignored_options = nil, &blk) click to toggle source

@private

# File lib/data_miner/step/process.rb, line 25
def initialize(script, method_id_or_description, ignored_options = nil, &blk)
  @script = script
  if block_given?
    @description = method_id_or_description
    @blk = blk
  else
    @description = method_id_or_description
    @method_id = method_id_or_description
  end
end

Public Instance Methods

start() click to toggle source

@private

# File lib/data_miner/step/process.rb, line 37
def start
  DataMiner::Script.uniq do
    if blk
      model.instance_eval(&blk)
    else
      model.send method_id
    end
  end
  nil
end