Sha256: 885c05624f776d36f1176b29d470dbe61bfcc534eeaf1d506b5024baa1e4a1ec

Contents?: true

Size: 641 Bytes

Versions: 3

Compression:

Stored size: 641 Bytes

Contents

module Controll::Flow::Action
  class Base
    attr_reader :path, :controller, :errors

    def initialize controller, path
      @controller = controller
      @path = path.to_s
    end

    def set_errors *errors
      @errors = errors.flatten
    end

    def errors
      @errors |= []
    end

    protected

    def controller_action
      @controller_action ||= "do_#{type}"
    end          

    def error_check!
      unless controller.respond_to? controller_action
        raise Controll::NotEnabled, "Controll::Enabler has not been included in #{controller.class}. Missing #{controller_action} method"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
controll-0.3.2 lib/controll/flow/action/base.rb
controll-0.3.1 lib/controll/flow/action/base.rb
controll-0.3.0 lib/controll/flow/action/base.rb