unidom-position 1.2.1 → 1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e8b51ab39c7303a1be2bec10c6bd38d056f5037b
4
- data.tar.gz: 6f87d57195f94417965495b518d679776ff5ad18
3
+ metadata.gz: 08bcb9be7f29b4850fca33fd2de11bc69a14d6eb
4
+ data.tar.gz: 5550bb98686bbb08082eefe201da839d64caee6e
5
5
  SHA512:
6
- metadata.gz: 9fb69bc485e094d96823a69af2cd9a35dddbbb9945dc02b02634cea2bef623fa5156fe3a6cd7c0e945e3a87e7c4d6d1fdbcc7bfac7f0415b5e9b47c9acd2b22d
7
- data.tar.gz: 2f47be89beeb5e1f6ff26be46e6ccf68cae903e01eb7f7537d51ac54eb77202943164ba6a0cfdd85983a05b6d4d74541ad46ce3c69a69bac915be1bac146883f
6
+ metadata.gz: b1b6f6bbf032fce2aa4339bdf06c85e77a354618f4348747e7563bbfcfd436299118a9912ddb28e6839e7940bd26129e7c51420a6bce40a74e96f29a4fbe5710
7
+ data.tar.gz: dbd097337fb6a25218b2c920dd5643b6a47ee39ab1bdcdbf378734945cbc62d7c45817cf59f7aa7cae117a4702605254b7113dc36391f1e2a48a7fb9619447e8
data/README.md CHANGED
@@ -52,9 +52,11 @@ include Unidom::Position::Concerns::AsSuperiorPost
52
52
  ### As Inferior Post
53
53
  The As Inferior Post concern do the following tasks for the includer automatically:
54
54
  1. Define the has_many :superior_post_reporting_structures macro as: ``has_many :superior_post_reporting_structures, class_name: 'Unidom::Position::PostReportingStructure', source: :inferior_post, foreign_key: :inferior_post_id``
55
- 2. Define the has_many :superior_posts macro as: ``has_many :superior_posts, through: :superior_post_reporting_structures, source: :superior_post``
55
+ 2. Define the has_many :superior_posts macro as: ``has_many :superior_posts, through: :superior_post_reporting_structures, source: :superior_post``
56
+ 3. Define the #report_to! method as: ``def report_to!(superior_post, at: Time.now, primary: false)``
56
57
 
57
58
  ### As Superior Post
58
59
  The As Superior Post concern do the following tasks for the includer automatically:
59
60
  1. Define the has_many :inferior_post_reporting_structures macro as: ``has_many :inferior_post_reporting_structures, class_name: 'Unidom::Position::PostReportingStructure', source: :superior_post, foreign_key: :superior_post_id``
60
- 2. Define the has_many :inferior_posts macro as: ``has_many :inferior_posts, through: :inferior_post_reporting_structures, source: :inferior_post``
61
+ 2. Define the has_many :inferior_posts macro as: ``has_many :inferior_posts, through: :inferior_post_reporting_structures, source: :inferior_post``
62
+ 3. Define the #is_reported_to! method as: ``def is_reported_to!(by: nil, at: Time.now, primary: false)``
@@ -2,11 +2,15 @@ module Unidom::Position::Concerns::AsInferiorPost
2
2
 
3
3
  extend ActiveSupport::Concern
4
4
 
5
- self.included do |includer|
5
+ included do |includer|
6
6
 
7
7
  has_many :superior_post_reporting_structures, class_name: 'Unidom::Position::PostReportingStructure', source: :inferior_post, foreign_key: :inferior_post_id
8
8
  has_many :superior_posts, through: :superior_post_reporting_structures, source: :superior_post
9
9
 
10
+ def report_to!(superior_post, at: Time.now, primary: false)
11
+ superior_post_reporting_structures.create! superior_post: superior_post, elemental: primary, opened_at: at
12
+ end
13
+
10
14
  end
11
15
 
12
16
  end
@@ -2,11 +2,15 @@ module Unidom::Position::Concerns::AsSuperiorPost
2
2
 
3
3
  extend ActiveSupport::Concern
4
4
 
5
- self.included do |includer|
5
+ included do |includer|
6
6
 
7
7
  has_many :inferior_post_reporting_structures, class_name: 'Unidom::Position::PostReportingStructure', source: :superior_post, foreign_key: :superior_post_id
8
8
  has_many :inferior_posts, through: :inferior_post_reporting_structures, source: :inferior_post
9
9
 
10
+ def is_reported_to!(by: nil, at: Time.now, primary: false)
11
+ inferior_post_reporting_structures.create! inferior_post: by, elemental: primary, opened_at: at
12
+ end
13
+
10
14
  end
11
15
 
12
16
  end
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Position
3
- VERSION = '1.2.1'.freeze
3
+ VERSION = '1.3'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unidom-position
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: '1.3'
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-08-15 00:00:00.000000000 Z
11
+ date: 2016-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common