Sha256: fa84cb734a2a80fec12507c7c0029e9e0e86155d6ff43a7b811c742a4f941fc0

Contents?: true

Size: 869 Bytes

Versions: 2

Compression:

Stored size: 869 Bytes

Contents

require File.join(File.dirname(__FILE__), 'slow_actions_computation_module')
class SlowActions
  private
  # Class to hold all #LogEntry objects that are associated with this individual #Action on a #Controller
  class Action
    include Computable
    # Create a new #Action object.
    #   name: the #name of the #Action. i.e. "new"
    #   controller: the #Controller this #Action is a part of
    def initialize(name, controller)
      @name = name
      @controller = controller
      @log_entries = []
    end

    # Name of this #Action
    attr_reader :name
    # #Controller of this #Action
    attr_reader :controller

    # Add a log entry to this #Action
    def add_entry(la)
      @log_entries << la
      la.action = self
    end
    # All the #LogEntry objects this #Action holds
    attr_reader :log_entries

    def to_s
      @name
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
slow-actions-0.3.4 lib/slow_actions/slow_actions_action.rb
slow-actions-0.3.3 lib/slow_actions/slow_actions_action.rb