Sha256: 58e0c1917858b1b488f7cbd85e69d04cfae182cf8599b46cd51de29598b2acba

Contents?: true

Size: 697 Bytes

Versions: 3

Compression:

Stored size: 697 Bytes

Contents

class DataMiner
  class Process
    attr_reader :config
    attr_reader :method_id
    attr_reader :block_description
    attr_reader :blk

    def initialize(config, method_id_or_block_description, &blk)
      @config = config
      if block_given?
        @block_description = method_id_or_block_description
        @blk = blk
      else
        @method_id = method_id_or_block_description
      end
    end
    
    def resource
      config.resource
    end
    
    def inspect
      %{#<DataMiner::Process(#{resource}) #{block_description || method_id}>}
    end
    
    def run
      if blk
        blk.call
      else
        resource.send method_id
      end
      nil
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
data_miner-1.1.8 lib/data_miner/process.rb
data_miner-1.1.6 lib/data_miner/process.rb
data_miner-1.1.5 lib/data_miner/process.rb