Sha256: 88cc39f2b50b3ad88120c1ddc287583c76bfa5f710280bd6ed470c340d6beda9

Contents?: true

Size: 940 Bytes

Versions: 1

Compression:

Stored size: 940 Bytes

Contents

module CanTango::Permit
  module Helper
    module Execution
      include CanTango::Helpers::Debug
      include CanTango::Permit::Helper::State

      # executes the permit
      def execute
        return if disabled?
        debug "Execute Permit: #{self}"
                
        # check current mode and execute accordingly!?
        calc_rules
        mode_rules
      end
      alias_method :execute!, :execute

      def mode_rules
        return unless modes.include? mode
        calc_rules_method = "#{mode}_rules"
        send(calc_rules_method) if respond_to?(calc_rules_method)
      end

      # return the executor used to execute the permit
      def executor
        @executor ||= case self.class.name
        when /System/
          then CanTango::Executor::Permit::System.new self
        else
          CanTango::Executor::Permit::Base.new self
        end
      end

      def calc_rules
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cantango-permits-0.1.1 lib/cantango/permit/helper/execution.rb