unidom-category 1.6.8 → 2.0

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
- SHA1:
3
- metadata.gz: a957f78833da7dbe6e46169e05c61dd0dd8b9f04
4
- data.tar.gz: 36e58beed05badb7d7b8bc9df80f0e6671054b31
2
+ SHA256:
3
+ metadata.gz: 4b95fafe9090ee138da10f43722f9a19e3ed1d49a6f6d005785752d65376cb99
4
+ data.tar.gz: c8d90b141ced89ea6cf3634e047dba9c9d5927722be8f9fdb1b20c029b061131
5
5
  SHA512:
6
- metadata.gz: c0fa5b22cf5cc2609aef6d2b94b9fc49c33cab4b5cd2ac73bdefdc0229c79bb35dc71e71df74847cabc3d21697a0ce0a8640dae4be35e70b3bf203c2a1e64fde
7
- data.tar.gz: c216c2cf042979b2b7fc99c242df9451c80fcda55f0ca0ae082e08761d973600842771fa956094db4161e4d939c67a8213f6db6a6c6e85e97b66015dd7a3a064
6
+ metadata.gz: 7403ead024cd8a02a328ef60062876f2e1dab63ce82c9aa9a7b6527a8de33b7da0828d3861717c450392c3f5d36ae5c9cf848bb95a6476219e07b85becbe9e0a
7
+ data.tar.gz: 525350d1c84656ad50da83970579a79a1d6bbc977a38893c880c5adc183611a19bba6a36160e285f2f2b5d1f3348a7657936db73abdd71619ba2592efd7d3f1c
data/README.md CHANGED
@@ -62,31 +62,42 @@ include Unidom::Category::Concerns::AsDescendantCategory
62
62
 
63
63
  The As Category concern do the following tasks for the includer automatically:
64
64
  1. Define the has_many :categorizings macro as: ``has_many :categorizings, class_name: 'Category::Categorizing'``
65
+
65
66
  2. Define the #categorize! method as: ``categorize!(categorized, at: Time.now, primary: true)``
67
+
66
68
  3. Define the #categorize? method as: ``categorize?(categorized, at: Time.now, primary: true)``
67
69
 
68
70
  ### As Categorized concern
69
71
 
70
72
  The As Categorized concern do the following tasks for the includer automatically:
71
73
  1. Define the has_many :categorizings macro as: ``has_many :categorizings, class_name: 'Unidom::Category::Categorizing', as: :categorized``
74
+
72
75
  2. Define the has_many :categories macro as: ``has_many :categories, through: :categorizings, source: :category``
76
+
73
77
  3. Define the #is_categorized! method as: ``is_categorized!(into: nil, at: Time.now, primary: true)``
78
+
74
79
  4. Define the #is_categorized? method as: ``is_categorized?(into: nil, at: Time.now, primary: true)``
75
80
 
76
81
  ### As Ancestor Category concern
77
82
 
78
83
  The As Ancestor Category concern do the following tasks for the includer automatically:
79
84
  1. Define the has_many :descendant_category_rollups macro as: ``has_many :descendant_category_rollups, class_name: 'Unidom::Category::CategoryRollup', foreign_key: :ancestor_category_id, source: :ancestor_category``
85
+
80
86
  2. Define the has_many :descendant_categories macro as: ``has_many :descendant_categories, class_name: 'Unidom::Category::Category', through: :descendant_category_rollups``
87
+
81
88
  3. Define the #roll_up! method as: ``roll_up!(it, at: Time.now, primary: true)``
89
+
82
90
  4. Define the #roll_up? method as: ``roll_up?(it, at: Time.now, primary: true)``
83
91
 
84
92
  ### As Descendant Category concern
85
93
 
86
94
  The As Descendant Category concern do the following tasks for the includer automatically:
87
95
  1. Define the has_many :ancestor_category_rollups macro as: ``has_many :ancestor_category_rollups, class_name: 'Unidom::Category::CategoryRollup', foreign_key: :descendant_category_id, source: :descendant_category``
96
+
88
97
  2. Define the has_many :ancestor_categories macro as: ``has_many :ancestor_categories, class_name: 'Unidom::Category::Category', through: :ancestor_category_rollups``
98
+
89
99
  3. Define the #is_rolled_up! as: ``is_rolled_up!(it, at: Time.now, primary: true)``
100
+
90
101
  4. Define the #is_rolled_up? as: ``is_rolled_up?(it, at: Time.now, primary: true)``
91
102
 
92
103
 
@@ -10,6 +10,10 @@ shared_examples 'Unidom::Category::Categorizing' do |model_attributes, categoriz
10
10
 
11
11
  it_behaves_like 'assert_present!', described_class, :categorize!, [ categorized, { into: category, at: Time.now } ], [ { 0 => :categorized }, :into, :at ]
12
12
 
13
+ it_behaves_like 'has_many', model_attributes, :categorized, categorized.class, [ categorized.attributes ]
14
+
15
+ it_behaves_like 'monomorphic scope', model_attributes, :category_is, :category, [ category.class ]
16
+
13
17
  end
14
18
 
15
19
  end
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Category
3
- VERSION = '1.6.8'.freeze
3
+ VERSION = '2.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unidom-category
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.8
4
+ version: '2.0'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Topbit Du
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-14 00:00:00.000000000 Z
11
+ date: 2020-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.9'
19
+ version: '2.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.9'
26
+ version: '2.0'
27
27
  description: Unidom (UNIfied Domain Object Model) is a series of domain model engines.
28
28
  The Category domain model engine includes Category and its relative models. Unidom
29
29
  (统一领域对象模型)是一系列的领域模型引擎。类别领域模型引擎包括类别及其相关的模型。
@@ -90,8 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  - !ruby/object:Gem::Version
91
91
  version: '0'
92
92
  requirements: []
93
- rubyforge_project:
94
- rubygems_version: 2.6.4
93
+ rubygems_version: 3.1.2
95
94
  signing_key:
96
95
  specification_version: 4
97
96
  summary: Unidom Category Domain Model Engine 类别领域模型引擎