wheres_my_weekend 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +7 -0
- data/.rubocop_todo.yml +25 -0
- data/.travis.yml +3 -1
- data/Gemfile +2 -0
- data/lib/wheres_my_weekend.rb +30 -4
- data/lib/wheres_my_weekend/version.rb +1 -1
- data/wheres_my_weekend.gemspec +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24065b0c7776dcfb648bdacadd27d1ace44c371f
|
4
|
+
data.tar.gz: 3279d8979b9fa01d560223474c3ccd54bedb6d88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da824d51ab65037a417a60ecdbb216fb8b8f9cedc663ccd2e798509cb6d7960a749f41aa6d7f3d85531c9965367c368881dcd1b51a9fc9cd076aee2e567d72ba
|
7
|
+
data.tar.gz: 8d685d6f109ae0eceb5e4154493683b5882a5be3850c107074cfbb04e549a7ae600a079dd9dbdf51606b1808f49d724bf58188eeb9a516444a166b1020fefb1a
|
data/.rubocop.yml
ADDED
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2017-01-09 18:17:31 -0200 using RuboCop version 0.46.0.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 1
|
10
|
+
# Cop supports --auto-correct.
|
11
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
|
12
|
+
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
|
13
|
+
Style/HashSyntax:
|
14
|
+
Exclude:
|
15
|
+
- 'Rakefile'
|
16
|
+
|
17
|
+
# Offense count: 19
|
18
|
+
# Cop supports --auto-correct.
|
19
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
|
20
|
+
# SupportedStyles: single_quotes, double_quotes
|
21
|
+
Style/StringLiterals:
|
22
|
+
Exclude:
|
23
|
+
- 'Rakefile'
|
24
|
+
- 'bin/console'
|
25
|
+
- 'wheres_my_weekend.gemspec'
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/lib/wheres_my_weekend.rb
CHANGED
@@ -1,24 +1,50 @@
|
|
1
1
|
require 'wheres_my_weekend/version'
|
2
|
+
require 'date'
|
2
3
|
|
3
4
|
SECONDS_PER_DAY = 86_400
|
4
5
|
|
5
|
-
|
6
|
+
# rubocop:disable Style/Documentation
|
7
|
+
module WeekendCheck
|
6
8
|
def weekend?
|
7
9
|
saturday? || sunday?
|
8
10
|
end
|
9
11
|
|
10
12
|
def next_weekend
|
11
|
-
[next_saturday, next_saturday
|
13
|
+
[next_saturday, next_saturday.add_days(1)]
|
12
14
|
end
|
13
15
|
|
14
16
|
protected
|
15
17
|
|
16
18
|
def last_saturday
|
17
|
-
saturday? ?
|
19
|
+
saturday? ? sub_days(7) : sub_days(wday + 1)
|
18
20
|
end
|
19
21
|
|
20
22
|
def next_saturday
|
21
|
-
saturday? ?
|
23
|
+
saturday? ? add_days(7) : add_days(6 - wday)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
class Time
|
28
|
+
include WeekendCheck
|
29
|
+
|
30
|
+
def add_days(n)
|
31
|
+
self + n.days
|
32
|
+
end
|
33
|
+
|
34
|
+
def sub_days(n)
|
35
|
+
self - n.days
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
class DateTime
|
40
|
+
include WeekendCheck
|
41
|
+
|
42
|
+
def add_days(n)
|
43
|
+
self + n
|
44
|
+
end
|
45
|
+
|
46
|
+
def sub_days(n)
|
47
|
+
self - n
|
22
48
|
end
|
23
49
|
end
|
24
50
|
|
data/wheres_my_weekend.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
17
|
f.match(%r{^(test|spec|features)/})
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
spec.bindir = "exe"
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ["lib"]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wheres_my_weekend
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Odinei Rocha
|
@@ -61,6 +61,8 @@ extra_rdoc_files: []
|
|
61
61
|
files:
|
62
62
|
- ".gitignore"
|
63
63
|
- ".rspec"
|
64
|
+
- ".rubocop.yml"
|
65
|
+
- ".rubocop_todo.yml"
|
64
66
|
- ".travis.yml"
|
65
67
|
- Gemfile
|
66
68
|
- LICENSE.txt
|