black_friday 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/lib/black_friday/version.rb +1 -1
- data/lib/black_friday.rb +6 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ffbcf76eea0862cddaa63f91a21a19eb41e666eb9321eb3115a8846a39c95ca
|
4
|
+
data.tar.gz: 942723a966fc7e783c3a3f5e39847c8b98dd5fca44acdde11c6e9f209f222250
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9572cb6a4739e4ac926f133783a88af828a8c571862f5430b52b8d693dc50ea035cfde6e56f31279dea77b7eaf97f34f622d67ecc7515e4645020b070f24bff0
|
7
|
+
data.tar.gz: aa148f4b131fded46ea48a28827723104f51687e9261e9e01554b7925ea68baac1d936e91f41bd5a6a7832e11cff256c1930c196dcd5be718a6733c9d284c4b4
|
data/README.md
CHANGED
@@ -56,6 +56,12 @@ BlackFriday.active?(:black_friday, :labor_day)
|
|
56
56
|
#=> true/false
|
57
57
|
```
|
58
58
|
|
59
|
+
Render a banner when a sale is active:
|
60
|
+
|
61
|
+
```erb
|
62
|
+
<%= render "banners/black_friday" if BlackFriday.active?(:black_friday) %>
|
63
|
+
```
|
64
|
+
|
59
65
|
To check the active sales:
|
60
66
|
|
61
67
|
```ruby
|
data/lib/black_friday/version.rb
CHANGED
data/lib/black_friday.rb
CHANGED
@@ -49,6 +49,12 @@ module BlackFriday
|
|
49
49
|
first_thursday + 3.weeks
|
50
50
|
end
|
51
51
|
|
52
|
+
def canadian_thanksgiving(year = Date.today.year)
|
53
|
+
oct_1st = Date.new(year, 10, 1)
|
54
|
+
first_monday = oct_1st.monday? ? oct_1st : oct_1st.next_occurring(:monday)
|
55
|
+
first_monday + 1.weeks
|
56
|
+
end
|
57
|
+
|
52
58
|
def black_friday(year = Date.today.year)
|
53
59
|
thanksgiving(year) + 1.day
|
54
60
|
end
|