coaster 1.4.7 → 1.4.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5e8ae6d7e690ce70628c0687e935bd182eb3257e1b6253790a00cbd3c9ed6fc9
4
- data.tar.gz: a9d9708ee72f4872184c9c2969b2b414015d48eedd99ee5bfe5881630f93bf25
3
+ metadata.gz: 41ba0c483410b98c561f02ad57afa970110a369b35c0cb407b9bde9e5a333013
4
+ data.tar.gz: 651ba61b273861c59b6ed676a4e85a88ada811ca1daa59282075dde6a1bf7bce
5
5
  SHA512:
6
- metadata.gz: c17c5fe51f8dc29c2961d74918b949a7f0907df3e0fbbc273f75cb60aaf15fc561f51dbc8b17cf53bdc113df173acf7439b47a58a1d2d33ae8310783422328c6
7
- data.tar.gz: cb22eedcdb827462e4b66beec6426a6b71561230e1fae62d873bd4244910ff1c1baeb176753e11734a7ec8db202d0e38472c1deef075a25fdabec2ea529a1fc0
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
@@ -13,7 +13,7 @@ def require_more
13
13
  more_load_paths = $LOAD_PATH.drop(load_path_index + 1)
14
14
  more_load_paths.each do |load_path|
15
15
  path = File.join(load_path, load_name)
16
- if File.exists?(path)
16
+ if File.exist?(path)
17
17
  return require_dependency path
18
18
  end
19
19
  end
@@ -1,3 +1,3 @@
1
1
  module Coaster
2
- VERSION = '1.4.7'
2
+ VERSION = '1.4.8'
3
3
  end
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.7
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-01-10 00:00:00.000000000 Z
11
+ date: 2024-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oj