unidom-price 1.2 → 1.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7806ecf665a86192aa2caab0df173c267e63ccce
|
4
|
+
data.tar.gz: 255d44b943b85da7e69f20069480f0f6129a0bc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e05188a599f91d77ea70f814010d3b4ee7f62daef4853a5091bcb5ff3a2cdb299322849993be9cc8085dcdcfccbcb1bc8b3cbf7899ec2354bd46f1e3f4c5c9ee
|
7
|
+
data.tar.gz: 82de092227a8e18099508296e072421fe48f635d9c49c6aeb55a4efc0d6d1e788cb1fcbac2974820c4b8cc0fed587412295b5d79b9acd14e92b243bf8ce6dc48
|
data/README.md
CHANGED
@@ -66,8 +66,10 @@ include Unidom::Price::Concerns::AsPricer
|
|
66
66
|
The As Priced concern do the following tasks for the includer automatically:
|
67
67
|
1. Define the has_many :prices macro as: ``has_many :prices, class_name: 'Unidom::Price::Price', as: :priced``
|
68
68
|
2. Define the #is_priced! method as: ``is_priced!(amount, by: nil, at: Time.now)``
|
69
|
+
3. Define the #is_priced? method as: ``is_priced?(at: Time.now)``
|
69
70
|
|
70
71
|
### As Pricer
|
71
72
|
The As Priced concern do the following tasks for the includer automatically:
|
72
73
|
1. Define the has_many :pricings macro as: ``has_many :pricings, class_name: 'Unidom::Price::Price', as: :pricer``
|
73
74
|
2. Define the #price! method as: ``price!(it, amount, at: Time.now)``
|
75
|
+
3. Define the #price? method as: ``price?(it, at: Time.now)``
|
@@ -12,9 +12,9 @@ module Unidom::Price::Concerns::AsPriced
|
|
12
12
|
prices.create! pricer: by, amount: amount, opened_at: at
|
13
13
|
end
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
def is_priced?(at: Time.now)
|
16
|
+
prices.valid_at(now: at).alive.exists?
|
17
|
+
end
|
18
18
|
|
19
19
|
end
|
20
20
|
|
@@ -12,9 +12,9 @@ module Unidom::Price::Concerns::AsPricer
|
|
12
12
|
pricings.create! priced: it, amount: amount, opened_at: at
|
13
13
|
end
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
def price?(it, at: Time.now)
|
16
|
+
pricings.priced_is(it).valid_at(now: at).alive.exists?
|
17
|
+
end
|
18
18
|
|
19
19
|
end
|
20
20
|
|
data/lib/unidom/price/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unidom-price
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '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-09-
|
11
|
+
date: 2016-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|