unidom-action 1.1 → 1.2

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: 87b412b4d3977bfe6aecef7b9c8b27ac899954b5
4
- data.tar.gz: d839f30d586c5f32cab8bb71427710fb4876b433
3
+ metadata.gz: c4ee75d7b364ec276f1447b370393f47b22d49ba
4
+ data.tar.gz: e33aee3de9c739432e5b2aca9e35e7c3349228ed
5
5
  SHA512:
6
- metadata.gz: 8afc0fed64acea96ba1c8b38bbc7a2f982423846505f5da9df5a83030a436d3ba6c2d8dd840b3ea0d9c0696cfc085707a3a60d0095afec1d10f432c69c6ab832
7
- data.tar.gz: 249df032859f87e078db5875f4e9350393dc52f3205d783ac07b2b10211a8a48102d58244b995c0e26d7471de94d9ef7b879460e56b1cccaf39f2e15ebec6fe6
6
+ metadata.gz: a0297e14d09ba3c61ee4d93dc53bc65bd7f0ab9fc520a048a4ea74362773d86c42e10db69465d1e1e5a499a260dba01a649cbef538582d7ac17688b52874fee2
7
+ data.tar.gz: 6de85f87e4e0ad423c57033d19774cf1d71fdbb0bd6fd91eb9c676793cb895854285c33eab38eb08559082e27309773f89f0e93c9384cca64aa462db6c75d434
data/README.md CHANGED
@@ -92,6 +92,7 @@ The As Actor Party concern do the following tasks for the includer automatically
92
92
 
93
93
  The As Obsolesced concern do the following tasks for the includer automatically:
94
94
  1. Define the has_many :obsolescings macro as: ``has_many :obsolescings, class_name: 'Unidom::Action::Obsolescing', as: :obsolesced``
95
+ 2. Define the #is_obsolesced! method as: ``is_obsolesced!(obsolescence_code: 'OBSL', due_to: nil, via: nil, by: nil, at: Time.now)``
95
96
 
96
97
  ### As Obsolescer Party concern
97
98
 
@@ -107,3 +108,4 @@ The As State Subject concern do the following tasks for the includer automatical
107
108
 
108
109
  The As State Transitor Party concern do the following tasks for the includer automatically:
109
110
  1. Define the has_many :transited_state_transitions macro as: ``has_many :transited_state_transitions, class_name: 'Unidom::Action::StateTransition', as: :transitor_party``
111
+ 2. Define the #is_transited! method as: ``is_transited!(from: nil, thru: nil, due_to: nil, via: nil, by: nil, at: Time.now)``
@@ -6,6 +6,22 @@ module Unidom::Action::Concerns::AsObsolesced
6
6
 
7
7
  has_many :obsolescings, class_name: 'Unidom::Action::Obsolescing', as: :obsolesced
8
8
 
9
+ def is_obsolesced!(obsolescence_code: 'OBSL', due_to: nil, via: nil, by: nil, at: Time.now)
10
+ obsolescings.create! obsolescence_code: 'OBSL', obsolescer_visitor: via, obsolescer_party: by, reason: due_to, opened_at: at
11
+ end
12
+
13
+ =begin
14
+ def is_obsolesced?(obsolescence_code: 'OBSL', due_to: nil, via: nil, by: nil, at: Time.now)
15
+ query = obsolescings
16
+ query = query.obsolescence_coded_as obsolescence_code if obsolescence_code.present?
17
+ query = query.obsolesced_by by if by.present?
18
+ query = query.obsolesced_via via if via.present?
19
+ query = query.caused_by due_to if due_to.present?
20
+ query = query.valid_at now: at if at.present?
21
+ query.exists?
22
+ end
23
+ =end
24
+
9
25
  end
10
26
 
11
27
  module ClassMethods
@@ -6,15 +6,15 @@ module Unidom::Action::Concerns::AsStateSubject
6
6
 
7
7
  has_many :state_transitions, class_name: 'Unidom::Action::StateTransition', as: :subject
8
8
 
9
- =begin
10
9
  def is_transited!(from: nil, thru: nil, due_to: nil, via: nil, by: nil, at: Time.now)
11
10
  state_transitions.create! from_state: from, thru_state: thru, transitor_visitor: via, transitor_party: by, reason: due_to, opened_at: at
12
11
  end
13
12
 
13
+ =begin
14
14
  def is_transited?(from: nil, thru: nil, due_to: nil, via: nil, by: nil, at: Time.now)
15
15
  query = state_transitions
16
16
  query = query.from_transited_to from if from.present?
17
- query = query.thru_transited_to from if thru.present?
17
+ query = query.thru_transited_to thru if thru.present?
18
18
  query = query.transited_by by if by.present?
19
19
  query = query.transited_via via if via.present?
20
20
  query = query.caused_by due_to if due_to.present?
@@ -22,6 +22,7 @@ module Unidom::Action::Concerns::AsStateSubject
22
22
  query.exists?
23
23
  end
24
24
  =end
25
+
25
26
  end
26
27
 
27
28
  module ClassMethods
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Action
3
- VERSION = '1.1'.freeze
3
+ VERSION = '1.2'.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.1'
4
+ version: '1.2'
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-09 00:00:00.000000000 Z
11
+ date: 2016-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common