unidom-action 1.5 → 1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 55cbae24fba8dfd04e3c7ae2055abc41ce26947f
4
- data.tar.gz: 6b6ca7374601719eddcd68bcc85b73b8d441fc57
3
+ metadata.gz: 7b0966362a906388ffb6f1f54282e6ba15502fd9
4
+ data.tar.gz: e5bbf2312ee05fb80c8e1ef8fda3aaf09a234bb5
5
5
  SHA512:
6
- metadata.gz: fb070469362ca1006a2e854041c1fadde8b60e357488db77010aef31349c176e09c66baa33bc4146a925a71a265ac2b9020126946dec4ffae59346bc45dc0c9c
7
- data.tar.gz: 56fac61e1c0deb33a10245abeedb5028bf6f88187c2a2b11135a3c98f3babab699e85c7564dc28ee2f0cf93fda34dc52ca493f75ee24c0c4fd0d020da07ba13c
6
+ metadata.gz: f48dd6b83206a3204d8de3ad6c18227df5f799d02e3f6240a342eb2ecd0a83d441d37d514363df4de34cd5b736c1c6893ec00e66472bd7460afcd7d4b7acb978
7
+ data.tar.gz: 96a4edcd01f85638ffb7b089d7c5b58719b410b3c14cf3bea7e37cdf0a4a499515ae92beee40c88907e279ffbd11b6be4e78aeccdcdeae7a55a0a94abd7a9d82
data/README.md CHANGED
@@ -85,7 +85,7 @@ include Unidom::Action::Concerns::AsStateTransitorParty
85
85
 
86
86
  The As Acted concern do the following tasks for the includer automatically:
87
87
  1. Define the has_many :actings macro as: ``has_many :actings, class_name: 'Unidom::Action::Acting', as: :acted``
88
- 2. Define the #is_acted! method as: ``is_acted!(from: nil, thru: nil, due_to: nil, by: nil, via: nil, at: Time.now, action_code: 'C')``
88
+ 2. Define the #is_acted! method as: ``is_acted!(from: nil, thru: nil, due_to: nil, by: nil, via: nil, at: Time.now, action_code: 'C')``
89
89
  3. Define the #is_acted? method as: ``is_acted?(due_to: nil, by: nil, via: nil, at: Time.now, action_code: 'C')``
90
90
 
91
91
  ### As Actor Party concern
@@ -104,6 +104,7 @@ The As Obsolesced concern do the following tasks for the includer automatically:
104
104
 
105
105
  The As Obsolescer Party concern do the following tasks for the includer automatically:
106
106
  1. Define the has_many :obsolesced_obsolescings macro as: ``has_many :obsolesced_obsolescings, class_name: 'Unidom::Action::Obsolescing', as: :obsolescer_party``
107
+ 2. Define the #obsolesce! method as: ``obsolesce!(it, obsolescence_code: 'OBSL', due_to: nil, via: nil, at: Time.now)``
107
108
 
108
109
  ### As State Subject concern
109
110
 
@@ -116,4 +117,4 @@ The As State Subject concern do the following tasks for the includer automatical
116
117
 
117
118
  The As State Transitor Party concern do the following tasks for the includer automatically:
118
119
  1. Define the has_many :transited_state_transitions macro as: ``has_many :transited_state_transitions, class_name: 'Unidom::Action::StateTransition', as: :transitor_party``
119
- 2. Define the #is_transited! method as: ``is_transited!(from: nil, thru: nil, due_to: nil, via: nil, by: nil, at: Time.now)``
120
+ 2. Define the #transit! method as: ``transit!(it, from: nil, thru: nil, due_to: nil, via: nil, at: Time.now)``
@@ -6,6 +6,22 @@ module Unidom::Action::Concerns::AsObsolescerParty
6
6
 
7
7
  has_many :obsolesced_obsolescings, class_name: 'Unidom::Action::Obsolescing', as: :obsolescer_party
8
8
 
9
+ def obsolesce!(it, obsolescence_code: 'OBSL', due_to: nil, via: nil, at: Time.now)
10
+ obsolesced_obsolescings.create! obsolesced: it, obsolescence_code: 'OBSL', obsolescer_visitor: via, reason: due_to, opened_at: at
11
+ end
12
+
13
+ =begin
14
+ def obsolesce?(it, obsolescence_code: 'OBSL', due_to: nil, via: nil, at: Time.now)
15
+ query = obsolesced_obsolescings
16
+ query = query.obsolesced_is it if it.present?
17
+ query = query.obsolesced_via via if via.present?
18
+ query = query.caused_by due_to if due_to.present?
19
+ query = query.obsolescence_coded_as obsolescence_code if obsolescence_code.present?
20
+ query = query.valid_at now: at if at.present?
21
+ query.alive.exists?
22
+ end
23
+ =end
24
+
9
25
  end
10
26
 
11
27
  module ClassMethods
@@ -12,10 +12,10 @@ module Unidom::Action::Concerns::AsStateSubject
12
12
 
13
13
  def is_transited?(from: nil, thru: nil, due_to: nil, via: nil, by: nil, at: Time.now)
14
14
  query = state_transitions
15
- query = query.from_transited_to from if from.present?
16
- query = query.thru_transited_to thru if thru.present?
17
15
  query = query.transited_by by if by.present?
18
16
  query = query.transited_via via if via.present?
17
+ query = query.from_transited_to from if from.present?
18
+ query = query.thru_transited_to thru if thru.present?
19
19
  query = query.caused_by due_to if due_to.present?
20
20
  query = query.valid_at now: at if at.present?
21
21
  query.exists?
@@ -6,6 +6,23 @@ module Unidom::Action::Concerns::AsStateTransitorParty
6
6
 
7
7
  has_many :transited_state_transitions, class_name: 'Unidom::Action::StateTransition', as: :transitor_party
8
8
 
9
+ def transit!(it, from: nil, thru: nil, due_to: nil, via: nil, at: Time.now)
10
+ transited_state_transitions.create! subject: it, from_state: from, thru_state: thru, transitor_visitor: via, reason: due_to, opened_at: at
11
+ end
12
+
13
+ =begin
14
+ def transit?(it, from: nil, thru: nil, due_to: nil, via: nil, at: Time.now)
15
+ query = transited_state_transitions
16
+ query = query.subject_is it if it.present?
17
+ query = query.transited_via via if via.present?
18
+ query = query.from_transited_to from if from.present?
19
+ query = query.thru_transited_to thru if thru.present?
20
+ query = query.caused_by due_to if due_to.present?
21
+ query = query.valid_at now: at if at.present?
22
+ query.alive.exists?
23
+ end
24
+ =end
25
+
9
26
  end
10
27
 
11
28
  module ClassMethods
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Action
3
- VERSION = '1.5'.freeze
3
+ VERSION = '1.6'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unidom-action
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.5'
4
+ version: '1.6'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Topbit Du
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-14 00:00:00.000000000 Z
11
+ date: 2016-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common