Class: MDWA::DSL::Process
- Inherits:
-
Object
- Object
- MDWA::DSL::Process
- Defined in:
- lib/mdwa/dsl/process.rb
Instance Attribute Summary collapse
-
#alias ⇒ Object
Returns the value of attribute alias.
-
#description ⇒ Object
Returns the value of attribute description.
-
#details ⇒ Object
Returns the value of attribute details.
-
#start_for_roles ⇒ Object
Returns the value of attribute start_for_roles.
Instance Method Summary collapse
- #detail(description) {|detail| ... } ⇒ Object
-
#initialize(description) ⇒ Process
constructor
A new instance of Process.
-
#process_detail(options = {}) ⇒ Object
Return the ProcessDetail based on alias, or entity and action.
- #start_for(role, detail_alias) ⇒ Object
Constructor Details
#initialize(description) ⇒ Process
Returns a new instance of Process.
10 11 12 13 14 15 16 17 |
# File 'lib/mdwa/dsl/process.rb', line 10 def initialize(description) self.description = description # Hash: [detail_alias] => ProcessDetail object self.details = {} # Hash: [role_alias] => detail_alias self.start_for_roles = {} end |
Instance Attribute Details
#alias ⇒ Object
Returns the value of attribute alias.
8 9 10 |
# File 'lib/mdwa/dsl/process.rb', line 8 def alias @alias end |
#description ⇒ Object
Returns the value of attribute description.
8 9 10 |
# File 'lib/mdwa/dsl/process.rb', line 8 def description @description end |
#details ⇒ Object
Returns the value of attribute details.
8 9 10 |
# File 'lib/mdwa/dsl/process.rb', line 8 def details @details end |
#start_for_roles ⇒ Object
Returns the value of attribute start_for_roles.
8 9 10 |
# File 'lib/mdwa/dsl/process.rb', line 8 def start_for_roles @start_for_roles end |
Instance Method Details
#detail(description) {|detail| ... } ⇒ Object
27 28 29 30 31 |
# File 'lib/mdwa/dsl/process.rb', line 27 def detail(description) detail = ProcessDetail.new(self, description) self.details[detail.alias] = detail yield(detail) if block_given? end |
#process_detail(options = {}) ⇒ Object
Return the ProcessDetail based on alias, or entity and action. Params: :alias => detail alias :entity :action
39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/mdwa/dsl/process.rb', line 39 def process_detail( = {}) detail = self.details[[:alias]] unless [:alias].blank? if detail.nil? self.details.values.each do |d| if( d.detail_action.entity == [:entity] and d.detail_action.action == [:action] ) detail = d break end end end return detail end |
#start_for(role, detail_alias) ⇒ Object
23 24 25 |
# File 'lib/mdwa/dsl/process.rb', line 23 def start_for(role, detail_alias) start_for_roles[role] = detail_alias end |