unidom-category 0.3 → 1.0

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: 78f1f392e8788a464de23a8ad9a58d48b9ba8cca
4
- data.tar.gz: 1ad515d53313b036ffa576f049a13f6da9bb83f0
3
+ metadata.gz: 655a4fd3e168dccb141486694c27d97cebbcf45b
4
+ data.tar.gz: e49a6fa4c16e13327124a8988367063ecc5dd99f
5
5
  SHA512:
6
- metadata.gz: 8485dba6321996d81ac620685268becd1cec51b930de237bd5f07b1f09b697340edfd977598e08a358f69bf97469899c7eaf3a647b9321aad27116e151405b67
7
- data.tar.gz: 8f5be63d2ad92f6714668c996544e3319fb70334a236d074ba463b0fa11f11e6e3fbb75bac0b3ae42f41efb92dd6a537a2523a41f4d99f01fdc18e5dc49b911a
6
+ metadata.gz: 70c9cc82bd5a4dc1c6056cf9d74e6a9185eac24d82565a65d07522983d5317780b7c28b56caaadb3664eb2858b19ec7279c533023b771f6d30531b52a9e3d0df
7
+ data.tar.gz: 165ecd5a0169d009807a2e3d7a567dc6297cc015670821e2f01935cc1ed900bd18353fe69071147cade904c1be7062823303f6c3d27327034c21ba1c675806f4
data/README.md CHANGED
@@ -24,7 +24,7 @@ The migration versions start with 200003.
24
24
  ## Call the Model
25
25
  ```ruby
26
26
  Unidom::Category::Category.coded_as('x1').scheme_is(scheme).valid_at.alive.first
27
- Unidom::Category::Categorizing.categorize!(category, product)
27
+ Unidom::Category::Categorizing.categorize! product, into: category, at: Time.now
28
28
 
29
- Unidom::Category::CategoryRollup.roll_up! parent_category, child_category
29
+ Unidom::Category::CategoryRollup.roll_up! child_category, into: parent_category, at: Time.now
30
30
  ```
@@ -12,8 +12,12 @@ class Unidom::Category::Categorizing < ActiveRecord::Base
12
12
  scope :category_is, ->(category) { where category_id: to_id(category) }
13
13
  scope :categorized_is, ->(categorized) { where categorized: categorized }
14
14
 
15
- def self.categorize!(category, categorized, opened_at = Time.now)
16
- self.categorized_is(categorized).category_is(category).valid_at.alive.first_or_create! elemental: true, opened_at: opened_at
15
+ #def self.categorize!(category, categorized, opened_at = Time.now)
16
+ # self.categorized_is(categorized).category_is(category).valid_at.alive.first_or_create! elemental: true, opened_at: opened_at
17
+ #end
18
+
19
+ def self.categorize!(categorized, into: nil, at: Time.now)
20
+ self.categorized_is(categorized).category_is(into).valid_at.alive.first_or_create! elemental: true, opened_at: at
17
21
  end
18
22
 
19
23
  end
@@ -28,8 +28,12 @@ class Unidom::Category::CategoryRollup < ActiveRecord::Base
28
28
  end
29
29
  }
30
30
 
31
- def self.roll_up!(ancestor_category, descendant_category, opened_at = Time.now)
32
- self.descendant_category_is(descendant_category).ancestor_category_is(ancestor_category).valid_at.alive.first_or_create! opened_at: opened_at
31
+ #def self.roll_up!(ancestor_category, descendant_category, opened_at = Time.now)
32
+ # self.descendant_category_is(descendant_category).ancestor_category_is(ancestor_category).valid_at.alive.first_or_create! opened_at: opened_at
33
+ #end
34
+
35
+ def self.roll_up!(descendant_category, into: nil, at: Time.now)
36
+ self.descendant_category_is(descendant_category).ancestor_category_is(into).valid_at.alive.first_or_create! opened_at: at
33
37
  end
34
38
 
35
39
  end
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Category
3
- VERSION = '0.3'.freeze
3
+ VERSION = '1.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: '0.3'
4
+ version: '1.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: 2016-08-03 00:00:00.000000000 Z
11
+ date: 2016-08-15 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: '0.9'
19
+ version: '1.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: '0.9'
26
+ version: '1.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
  (统一领域对象模型)是一系列的领域模型引擎。类别领域模型引擎包括类别及其相关的模型。