Sha256: e96a27431dc410cf3f3e67d037c38649ea1508c7edb88bd529c085bf19cd5a21

Contents?: true

Size: 1.55 KB

Versions: 13

Compression:

Stored size: 1.55 KB

Contents

# -*- encoding : utf-8 -*-
require 'ostruct'
module MDWA
  module DSL
    
    class ProcessDetail
      attr_accessor :process, :description, :alias, :user_roles, :detail_action, :next_actions
      
      def initialize(process, description)
        self.process      = process
        self.description  = description
        
        self.user_roles   = []
        self.next_actions = []
        self.detail_action = OpenStruct.new
      end
      
      # Unique alias for detailing
      # Default: Detail name underscored
      def alias
        @alias ||= self.description.gsub(' ', '_').underscore
      end
      
      # Refered action
      # Params: 
      # => :entity
      # => :action
      def action(entity, action)
        self.detail_action.entity = entity
        self.detail_action.action = action
      end
      
      # Possible next action
      # Params: 
      # => :alias
      # => :entity
      # => :action
      # => :method
      # => :request
      # => :redirect  => boolean
      # => :render    => boolean
      # => :when - situation when it might occur
      def next_action(detail_alias, options = {})
        next_action = ProcessDetailNextAction.new(detail_alias)
        next_action.method    = options[:method] || :get
        next_action.request   = options[:request] || :html
        next_action.redirect  = options[:redirect] || false
        next_action.render    = options[:render] || false
        next_action.when      = options[:when]

        next_actions << next_action
      end
            
    end
    
  end # dsl
end # mdwa

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
mdd-3.0.18 lib/mdwa/dsl/process_detail.rb
mdd-3.0.17 lib/mdwa/dsl/process_detail.rb
mdd-3.0.16 lib/mdwa/dsl/process_detail.rb
mdd-3.0.15 lib/mdwa/dsl/process_detail.rb
mdd-3.0.14 lib/mdwa/dsl/process_detail.rb
mdd-3.0.13 lib/mdwa/dsl/process_detail.rb
mdd-3.0.10 lib/mdwa/dsl/process_detail.rb
mdd-3.0.9 lib/mdwa/dsl/process_detail.rb
mdd-3.0.8 lib/mdwa/dsl/process_detail.rb
mdd-3.0.7 lib/mdwa/dsl/process_detail.rb
mdd-3.0.6 lib/mdwa/dsl/process_detail.rb
mdd-3.0.4 lib/mdwa/dsl/process_detail.rb
mdd-3.0.3 lib/mdwa/dsl/process_detail.rb