black_friday 1.0.2 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +8 -2
- data/lib/black_friday/version.rb +1 -1
- data/lib/black_friday.rb +8 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e23c17366d25e68bd87d013eaad0ce6d85b59c791dddcbf1015586ccd533727
|
4
|
+
data.tar.gz: 0fbd019abb0e765476f9360110ad6eb43a16266298be9a3dcc11295b24976fcb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e573a96174ddfb06dc8ca4373711ee238cf107f28af55f411ac0e824be237189fce146abc9bfad1bff54aff57b99cd01d1d6b2808ef9c2ff6b91ca65b0e59be6
|
7
|
+
data.tar.gz: 560eeca28bbc44e4e8c60d6a4cbd0b1e10e065d824c39483af54a1367f733f85df78a5e0103231b34567fb302d4c88fb96aacd2269fcc7f5f49d18628a419179
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [1.0.4] - 2024-11-27
|
4
|
+
|
5
|
+
- Fix `current_sales` to return an array of names, not a hash.
|
6
|
+
|
7
|
+
## [1.0.3] - 2024-11-22
|
8
|
+
|
9
|
+
- Add Canadian Thanksgiving
|
10
|
+
- Add `range_for(name)` to retrieve a range easily
|
11
|
+
|
3
12
|
## [1.0.2] - 2024-11-22
|
4
13
|
|
5
14
|
- Add `BlackFriday.range_for(:name)` to retrieve a range
|
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
|
@@ -73,7 +79,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
73
79
|
|
74
80
|
## Contributing
|
75
81
|
|
76
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
82
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/excid3/black_friday. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/excid3/black_friday/blob/main/CODE_OF_CONDUCT.md).
|
77
83
|
|
78
84
|
## License
|
79
85
|
|
@@ -81,4 +87,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
81
87
|
|
82
88
|
## Code of Conduct
|
83
89
|
|
84
|
-
Everyone interacting in the BlackFriday project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
90
|
+
Everyone interacting in the BlackFriday project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/excid3/black_friday/blob/main/CODE_OF_CONDUCT.md).
|
data/lib/black_friday/version.rb
CHANGED
data/lib/black_friday.rb
CHANGED
@@ -24,8 +24,8 @@ module BlackFriday
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def current_sales
|
27
|
-
sales.
|
28
|
-
in_range? instance_eval(&block)
|
27
|
+
sales.filter_map do |name, block|
|
28
|
+
name if in_range? instance_eval(&block)
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
@@ -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
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: black_friday
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Oliver
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-11-
|
11
|
+
date: 2024-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|