unidom-category 1.4 → 1.5

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: 57cc5460c2f1067539f7fef4c2e320f42d07159b
4
- data.tar.gz: 78b0cca4a7599d517d661ccadc7ac9a1d20cfc88
3
+ metadata.gz: e616b1c45ec60ec69bbd13ec315c19cf3ecc2a10
4
+ data.tar.gz: af7eb47899e2707782119ed136cae02fd3c6846e
5
5
  SHA512:
6
- metadata.gz: 5e49f397ef5af6e9f18de3fba2894428a7942031fb17b45ca4b5e630fb2db35cbfef1b2b20c9928430c879a7574542deed4f3c86bf51fc6c76e1ef704c6d7790
7
- data.tar.gz: 7324aab9be40d6620756b719687595c9840f566173086f9d6ae55560cb35eea4df4cdf86c43286238f55b2824bd7ed9ce2f80e15fe7a47a3dd2b2ff807625cf9
6
+ metadata.gz: 319e5f50d915c6f165c1ccc970f0917b36115d24b6280b21db8310204e5e60d9d288c6e9e0ae19660cda951d46bab16f19a35452fe16d438d8fdd4654da37d47
7
+ data.tar.gz: 2f2113742c8131fc318940ab3ea341cdef83162bcccc8c61aa87ca3dcc585e7d03c5f267a07d81fdc0763b21936b52759dff6594e1883a7c09c2c89f00e696db
data/README.md CHANGED
@@ -75,12 +75,14 @@ The As Categorized concern do the following tasks for the includer automatically
75
75
 
76
76
  The As Ancestor Category concern do the following tasks for the includer automatically:
77
77
  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``
78
- 2. Define the has_many :descendant_categories macro as: ``has_many :descendant_categories, class_name: 'Unidom::Category::Category', through: :descendant_category_rollups``
78
+ 2. Define the has_many :descendant_categories macro as: ``has_many :descendant_categories, class_name: 'Unidom::Category::Category', through: :descendant_category_rollups``
79
79
  3. Define the #roll_up! method as: ``roll_up!(it, at: Time.now, primary: true)``
80
+ 4. Define the #roll_up? method as: ``roll_up?(it, at: Time.now, primary: true)``
80
81
 
81
82
  ### As Descendant Category concern
82
83
 
83
84
  The As Descendant Category concern do the following tasks for the includer automatically:
84
85
  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``
85
- 2. Define the has_many :ancestor_categories macro as: ``has_many :ancestor_categories, class_name: 'Unidom::Category::Category', through: :ancestor_category_rollups``
86
+ 2. Define the has_many :ancestor_categories macro as: ``has_many :ancestor_categories, class_name: 'Unidom::Category::Category', through: :ancestor_category_rollups``
86
87
  3. Define the #is_rolled_up! as: ``is_rolled_up!(it, at: Time.now, primary: true)``
88
+ 4. Define the #is_rolled_up? as: ``is_rolled_up?(it, at: Time.now, primary: true)``
@@ -28,12 +28,8 @@ class Unidom::Category::CategoryRollup < ActiveRecord::Base
28
28
  end
29
29
  }
30
30
 
31
- def self.roll_up!(descendant_category, into: nil, at: Time.now)
32
- self.descendant_category_is(descendant_category).ancestor_category_is(into).valid_at.alive.first_or_create! opened_at: at
31
+ def self.roll_up!(it, into: nil, at: Time.now)
32
+ self.descendant_category_is(it).ancestor_category_is(into).valid_at(now: at).alive.first_or_create! opened_at: at
33
33
  end
34
34
 
35
- #def self.roll_up!(it, into: nil, at: Time.now)
36
- # self.descendant_category_is(it).ancestor_category_is(into).valid_at(now: at).alive.first_or_create! opened_at: at
37
- #end
38
-
39
35
  end
@@ -14,9 +14,9 @@ module Unidom::Category::Concerns::AsAncestorCategory
14
14
  rollup
15
15
  end
16
16
 
17
- #def roll_up?(it, at: Time.now, primary: true)
18
- # descendant_category_rollups.descendant_category_is(it).primary(primary).valid_at(now: at).alive.exists?
19
- #end
17
+ def roll_up?(it, at: Time.now, primary: true)
18
+ descendant_category_rollups.descendant_category_is(it).primary(primary).valid_at(now: at).alive.exists?
19
+ end
20
20
 
21
21
  end
22
22
 
@@ -14,9 +14,9 @@ module Unidom::Category::Concerns::AsDescendantCategory
14
14
  rollup
15
15
  end
16
16
 
17
- #def is_rolled_up?(it, at: Time.now, primary: true)
18
- # ancestor_category_rollups.ancestor_category_is(it).primary(primary).valid_at(now: at).alive.exists?
19
- #end
17
+ def is_rolled_up?(it, at: Time.now, primary: true)
18
+ ancestor_category_rollups.ancestor_category_is(it).primary(primary).valid_at(now: at).alive.exists?
19
+ end
20
20
 
21
21
  end
22
22
 
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Category
3
- VERSION = '1.4'.freeze
3
+ VERSION = '1.5'.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.4'
4
+ version: '1.5'
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-08 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