coaster 1.4.7 → 1.4.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/coaster/core_ext/month.rb +8 -4
- data/lib/coaster/core_ext/require_more.rb +1 -1
- data/lib/coaster/version.rb +1 -1
- data/test/test_month.rb +10 -0
- 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: 41ba0c483410b98c561f02ad57afa970110a369b35c0cb407b9bde9e5a333013
|
4
|
+
data.tar.gz: 651ba61b273861c59b6ed676a4e85a88ada811ca1daa59282075dde6a1bf7bce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 864c6e513179cae78a768acc6335752c5dba18f4bd6110ea58613b0b51dc0ad5c19ff3cfcf7171133f1db8041b09cabc196dc976113451cefc51ad5cd1d7317c
|
7
|
+
data.tar.gz: 3b067f4ae39fd0bb24f91b0dc0f2ce813b57fe8e132c842f6b9023a860c91edcdd99f54e925aeb4f94837cea80101e2043d370b653cefede3a7b11a714391ecd
|
@@ -113,20 +113,24 @@ class Month
|
|
113
113
|
|
114
114
|
def -(time)
|
115
115
|
case time
|
116
|
-
when ActiveSupport::Duration then first_date.in_time_zone(timezone) - time
|
116
|
+
when ActiveSupport::Duration then Month.from(first_date.in_time_zone(timezone) - time)
|
117
117
|
else
|
118
|
-
first_date - time
|
118
|
+
Month.from(first_date - time)
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
122
122
|
def +(time)
|
123
123
|
case time
|
124
|
-
when ActiveSupport::Duration then first_date.in_time_zone(timezone) + time
|
124
|
+
when ActiveSupport::Duration then Month.from(first_date.in_time_zone(timezone) + time)
|
125
125
|
else
|
126
|
-
first_date + time
|
126
|
+
Month.from(first_date + time)
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
130
|
+
def cover?(t)
|
131
|
+
to_time_range.cover?(t)
|
132
|
+
end
|
133
|
+
|
130
134
|
include Comparable
|
131
135
|
def <=>(other)
|
132
136
|
first_date <=> Month.from(other).first_date
|
data/lib/coaster/version.rb
CHANGED
data/test/test_month.rb
CHANGED
@@ -3,6 +3,10 @@ require 'minitest/autorun'
|
|
3
3
|
|
4
4
|
module Coaster
|
5
5
|
class TestMonth < Minitest::Test
|
6
|
+
def setup
|
7
|
+
Time.zone = 'Asia/Seoul'
|
8
|
+
end
|
9
|
+
|
6
10
|
def test_month
|
7
11
|
m = Month.parse('202001')
|
8
12
|
assert_equal m.year, 2020
|
@@ -58,5 +62,11 @@ module Coaster
|
|
58
62
|
assert_equal d.prev_specific_date(30), Date.parse('20200130')
|
59
63
|
assert_equal d.prev_specific_date(31), Date.parse('20200131')
|
60
64
|
end
|
65
|
+
|
66
|
+
def test_range
|
67
|
+
mn = Month.now
|
68
|
+
range = (mn..mn)
|
69
|
+
assert range.cover?(Month.from(Date.today))
|
70
|
+
end
|
61
71
|
end
|
62
72
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coaster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- buzz jung
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oj
|