when_exe 0.4.6 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +5 -5
  2. data/LICENSE.ja.txt +8 -21
  3. data/LICENSE.txt +5 -27
  4. data/README.md +8 -63
  5. data/bin/make_ttl.rb +3 -2
  6. data/bin/make_ttl.rb.config +3 -3
  7. data/lib/when_exe.rb +8 -3
  8. data/lib/when_exe/basictypes.rb +1 -2
  9. data/lib/when_exe/calendarnote.rb +9 -5
  10. data/lib/when_exe/calendartypes.rb +4 -4
  11. data/lib/when_exe/coordinates.rb +14 -18
  12. data/lib/when_exe/ephemeris.rb +5 -6
  13. data/lib/when_exe/events.rb +7 -7
  14. data/lib/when_exe/google_api.rb +26 -31
  15. data/lib/when_exe/icalendar.rb +8 -8
  16. data/lib/when_exe/inspect.rb +3 -3
  17. data/lib/when_exe/linkeddata.rb +10 -2
  18. data/lib/when_exe/locales/locale.rb +2 -2
  19. data/lib/when_exe/parts/enumerator.rb +3 -3
  20. data/lib/when_exe/parts/geometric_complex.rb +2 -2
  21. data/lib/when_exe/parts/resource.rb +2 -2
  22. data/lib/when_exe/parts/timezone.rb +17 -29
  23. data/lib/when_exe/region/balinese.rb +5 -3
  24. data/lib/when_exe/region/chinese.rb +25 -3
  25. data/lib/when_exe/region/chinese/twins.rb +128 -5
  26. data/lib/when_exe/region/dee.rb +4 -4
  27. data/lib/when_exe/region/geologicalage.rb +137 -126
  28. data/lib/when_exe/region/hanke_henry.rb +4 -4
  29. data/lib/when_exe/region/indian.rb +73 -4
  30. data/lib/when_exe/region/international_fixed.rb +3 -3
  31. data/lib/when_exe/region/japanese.rb +9 -5
  32. data/lib/when_exe/region/japanese/epochs.rb +8 -4
  33. data/lib/when_exe/region/japanese/notes.rb +25 -7
  34. data/lib/when_exe/region/japanese/residues.rb +32 -10
  35. data/lib/when_exe/region/japanese/weeks.rb +7 -7
  36. data/lib/when_exe/region/korean.rb +17 -17
  37. data/lib/when_exe/region/saudi_arabian.rb +57 -0
  38. data/lib/when_exe/region/world.rb +3 -3
  39. data/lib/when_exe/timestandard.rb +7 -5
  40. data/lib/when_exe/tmobjects.rb +2 -2
  41. data/lib/when_exe/tmposition.rb +6 -4
  42. data/lib/when_exe/tmreference.rb +3 -3
  43. data/lib/when_exe/version.rb +3 -3
  44. data/test/events/example-datasets +0 -1
  45. data/test/events/japanese-holiday.csv +23 -6
  46. data/test/events/japanese-holiday.ttl +321 -151
  47. data/test/test/basictypes.rb +2 -2
  48. data/test/test/calendarnote.rb +2 -2
  49. data/test/test/coordinates.rb +6 -4
  50. data/test/test/ephemeris.rb +2 -2
  51. data/test/test/google_api.rb +45 -32
  52. data/test/test/inspect.rb +2 -2
  53. data/test/test/parts.rb +5 -5
  54. data/test/test/region/christian.rb +7 -7
  55. data/test/test/region/indian.rb +14 -1
  56. data/test/test/region/islamic.rb +11 -1
  57. data/test/test/region/japanese.rb +3 -3
  58. data/test/test/region/m17n.rb +2 -2
  59. data/test/test/region/reforms.rb +2 -2
  60. data/test/test/tmposition.rb +7 -7
  61. metadata +7 -8
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  =begin
3
- Copyright (C) 2011-2015 Takashi SUGA
3
+ Copyright (C) 2011-2020 Takashi SUGA
4
4
 
5
5
  You may use and/or modify this file according to the license
6
6
  described in the LICENSE.txt file included in this archive.
@@ -395,7 +395,7 @@ LOCALE
395
395
  def test__code_space
396
396
  assert_equal('zip', Term1.codeSpace)
397
397
  assert_equal("ISO", Term2.codeSpace)
398
- assert_equal(nil, Term3.codeSpace)
398
+ assert_nil(Term3.codeSpace)
399
399
  end
400
400
 
401
401
  def test__label
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  =begin
3
- Copyright (C) 2014 Takashi SUGA
3
+ Copyright (C) 2014-2020 Takashi SUGA
4
4
 
5
5
  You may use and/or modify this file according to the license
6
6
  described in the LICENSE.txt file included in this archive.
@@ -51,7 +51,7 @@ module MiniTest::CalendarNote
51
51
  assert_equal([[{:note=>"干支", :value=>"癸巳(29)", :position=>"共通"}],
52
52
  [{:note=>"干支", :value=>"壬辰(28)", :position=>"共通"}]], notes1.subset(:note=>'干支'))
53
53
  assert_equal([[{:note=>"祝祭日", :value=>"秋分の日", :position=>"祝祭日"}]], notes1.subset(:value=>'秋分の日'))
54
- assert_equal(nil, notes1.subset(:value=>'春分の日'))
54
+ assert_nil(notes1.subset(:value=>'春分の日'))
55
55
  assert_equal([[nil], [nil], [nil, nil, nil, nil, nil]], notes1.subset({:value=>'春分の日'}, false))
56
56
 
57
57
  assert_equal([2456558, 2456559, 2456560], all.keys)
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  =begin
3
- Copyright (C) 2011-2015 Takashi SUGA
3
+ Copyright (C) 2011-2019 Takashi SUGA
4
4
 
5
5
  You may use and/or modify this file according to the license
6
6
  described in the LICENSE.txt file included in this archive.
@@ -175,10 +175,12 @@ module MiniTest::Coordinates
175
175
  ["Emperor_Taishō", "https://en.wikipedia.org/wiki/Emperor_Taish%C5%8D"],
176
176
  ["昭和天皇", "https://ja.wikipedia.org/wiki/%E6%98%AD%E5%92%8C%E5%A4%A9%E7%9A%87"],
177
177
  ["Emperor_Shōwa", "https://en.wikipedia.org/wiki/Emperor_Sh%C5%8Dwa"],
178
- ["今上天皇", "https://ja.wikipedia.org/wiki/%E6%98%8E%E4%BB%81"],
179
- ["Emperor_Kinjō", "https://en.wikipedia.org/wiki/Akihito"]
178
+ ["上皇明仁", "https://ja.wikipedia.org/wiki/%E4%B8%8A%E7%9A%87%E6%98%8E%E4%BB%81"],
179
+ ["Emperor_Emeritus_of_Japan", "https://en.wikipedia.org/wiki/Akihito"],
180
+ ["今上天皇", "https://ja.wikipedia.org/wiki/%E5%BE%B3%E4%BB%81"],
181
+ ["Emperor_Kinjō", "https://en.wikipedia.org/wiki/Naruhito"]
180
182
  ]
181
- ['明治', '大正', '昭和', '平成'].each do |nengo|
183
+ ['明治', '大正', '昭和', '平成', '令和'].each do |nengo|
182
184
  name = When.when?(nengo + '06.01.01').query['name']
183
185
  ['ja', 'en'].each do |lang|
184
186
  assert_equal(sample.shift, [name.translate(lang), name.reference(lang)])
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  =begin
3
- Copyright (C) 2011-2014 Takashi SUGA
3
+ Copyright (C) 2011-2020 Takashi SUGA
4
4
 
5
5
  You may use and/or modify this file according to the license
6
6
  described in the LICENSE.txt file included in this archive.
@@ -59,7 +59,7 @@ module MiniTest::Ephemeris
59
59
 
60
60
  assert_raises(NoMethodError) { When.when?('2012-11-15').sunrise }
61
61
 
62
- assert_equal(nil, When.when?('2013-06-21T+09:00', :long=>135, :lat=>70).sunrise)
62
+ assert_nil(When.when?('2013-06-21T+09:00', :long=>135, :lat=>70).sunrise)
63
63
 
64
64
  if Object.const_defined?(:TZInfo)
65
65
  assert_equal(0, /2012-11-15T06:16/ =~ When.when?('2012-11-15', :tz=>'Asia/Tokyo').sunrise.to_s)
@@ -1,56 +1,69 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  =begin
3
- Copyright (C) 2015 Takashi SUGA
3
+ Copyright (C) 2015-2021 Takashi SUGA
4
4
 
5
5
  You may use and/or modify this file according to the license
6
6
  described in the LICENSE.txt file included in this archive.
7
+
8
+ Before running this script, please create "credentials.json" and "token.yaml" by
9
+ running quickstart.rb according to the Quick Start description at the URL below,
10
+ and place them in the same directory as test.rb.
11
+
12
+ https://developers.google.com/calendar/quickstart/ruby
13
+
7
14
  =end
8
15
 
9
16
  require 'fileutils'
10
- require 'yaml'
11
- require 'google/api_client' if FileTest.exist?('google-api.yaml')
17
+ if FileTest.exist?("token.yaml")
18
+ require "google/apis/calendar_v3"
19
+ require "googleauth"
20
+ require "googleauth/stores/file_token_store"
21
+ end
12
22
 
13
23
  module MiniTest
14
24
 
15
25
  class GoogleAPI < MiniTest::TestCase
16
26
 
17
27
  HOLIDAYS = [
18
- ["2015-01-01", "New Year's Day" ],
19
- ["2015-01-12", "Coming of Age Day" ],
20
- ["2015-02-11", "National Foundation Day" ],
21
- ["2015-03-21", "Spring Equinox" ],
22
- ["2015-04-29", "Shōwa Day" ],
23
- ["2015-05-03", "Constitution Memorial Day" ],
24
- ["2015-05-04", "Greenery Day" ],
25
- ["2015-05-05", "Children's Day" ],
26
- ["2015-05-06", "Constitution Memorial Day observed"],
27
- ["2015-07-20", "Sea Day" ],
28
- ["2015-09-21", "Respect for the Aged Day" ],
29
- ["2015-09-22", "Bridge Public holiday" ],
30
- ["2015-09-23", "Autumn Equinox" ],
31
- ["2015-10-12", "Sports Day" ],
32
- ["2015-11-03", "Culture Day" ],
33
- ["2015-11-23", "Labor Thanksgiving Day" ],
34
- ["2015-12-23", "Emperor's Birthday" ]
28
+ ["2021-01-01", "New Year's Day"],
29
+ ["2021-01-11", "Coming of Age Day"],
30
+ ["2021-02-11", "National Foundation Day"],
31
+ ["2021-02-23", "Emperor's Birthday"],
32
+ ["2021-03-20", "Spring Equinox"],
33
+ ["2021-04-29", "Shōwa Day"],
34
+ ["2021-05-03", "Constitution Memorial Day"],
35
+ ["2021-05-04", "Greenery Day"],
36
+ ["2021-05-05", "Children's Day"],
37
+ ["2021-07-22", "Sea Day"],
38
+ ["2021-07-23", "Sports Day"],
39
+ ["2021-08-08", "Mountain Day"],
40
+ ["2021-08-09", "Day off for Mountain Day"],
41
+ ["2021-09-20", "Respect for the Aged Day"],
42
+ ["2021-09-23", "Autumn Equinox"],
43
+ ["2021-11-03", "Culture Day"],
44
+ ["2021-11-23", "Labor Thanksgiving Day"]
35
45
  ]
36
46
 
37
- if FileTest.exist?('google-api.yaml')
47
+ def authorize
48
+ client_id = Google::Auth::ClientId.from_file "credentials.json"
49
+ scope = Google::Apis::CalendarV3::AUTH_CALENDAR_READONLY
50
+ token_store = Google::Auth::Stores::FileTokenStore.new file: "token.yaml"
51
+ authorizer = Google::Auth::UserAuthorizer.new client_id, scope, token_store
52
+ authorizer.get_credentials "default"
53
+ end
54
+
55
+ if FileTest.exist?("token.yaml")
38
56
 
39
57
  def test__enum_for
40
- oauth_yaml = YAML.load_file('google-api.yaml')
41
- client = Google::APIClient.new(:application_name => "when_exe",
42
- :application_version => When::VERSION)
43
- client.authorization.client_id = oauth_yaml["client_id"]
44
- client.authorization.client_secret = oauth_yaml["client_secret"]
45
- client.authorization.scope = oauth_yaml["scope"]
46
- client.authorization.refresh_token = oauth_yaml["refresh_token"]
47
- client.authorization.access_token = oauth_yaml["access_token"]
48
- service = client.discovered_api('calendar', 'v3')
49
- calendar = When::GoogleAPI::Calendar.list(client, service,
58
+ service = Google::Apis::CalendarV3::CalendarService.new
59
+ service.client_options.application_name = "Google Calendar API Ruby Test"
60
+ service.authorization = authorize
61
+
62
+ calendar = When::GoogleAPI::Calendar.list(service,
50
63
  'en.japanese#holiday@group.v.calendar.google.com')
51
64
  assert_equal(calendar.calendar_id, 'en.japanese#holiday@group.v.calendar.google.com')
52
65
  holidays = HOLIDAYS.dup
53
- calendar.enum_for(When.when?('20150101/1231')).each do |date|
66
+ calendar.enum_for(When.when?('20210101/1231')).each do |date|
54
67
  assert_equal(holidays.shift, [date.to_s, date.events[0].summary])
55
68
  end
56
69
  assert_equal([], holidays)
data/test/test/inspect.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  =begin
3
- Copyright (C) 2011-2015 Takashi SUGA
3
+ Copyright (C) 2011-2020 Takashi SUGA
4
4
 
5
5
  You may use and/or modify this file according to the license
6
6
  described in the LICENSE.txt file included in this archive.
@@ -37,7 +37,7 @@ module MiniTest
37
37
  clock = When.Clock('+09:00')
38
38
  #pp clock.to_s
39
39
  assert_equal("+09:00", clock.label.to_s)
40
- assert_equal(nil, clock.referenceEvent)
40
+ assert_nil(clock.referenceEvent)
41
41
  assert_equal("T00+09:00", clock.referenceTime.to_s)
42
42
  assert_equal("T*15:00:00Z", clock.utcReference.to_s)
43
43
  end
data/test/test/parts.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  =begin
3
- Copyright (C) 2011-2015 Takashi SUGA
3
+ Copyright (C) 2011-2020 Takashi SUGA
4
4
 
5
5
  You may use and/or modify this file according to the license
6
6
  described in the LICENSE.txt file included in this archive.
@@ -96,8 +96,8 @@ LOCALE
96
96
  end
97
97
 
98
98
  def test__reference
99
- assert_equal(nil, Term1.reference('ja_JP'))
100
- assert_equal(nil, Term1.reference('en_US'))
99
+ assert_nil(Term1.reference('ja_JP'))
100
+ assert_nil(Term1.reference('en_US'))
101
101
  assert_equal("https://ja.wikipedia.org/wiki/Getsuyou", Term2.reference('ja_JP'))
102
102
  assert_equal("https://en.wikipedia.org/wiki/Monday", Term2.reference('en_US'))
103
103
  assert_equal("https://ja.wikipedia.org/wiki/%E6%9C%88%E6%9B%9C%E6%97%A5", Term3.reference('ja_JP'))
@@ -164,14 +164,14 @@ LOCALE
164
164
 
165
165
  sample = [false, false, false, false, false]
166
166
  complex = When::Parts::GeometricComplex.new(false)
167
- assert_equal(nil, complex.exclude_end?)
167
+ assert_nil(complex.exclude_end?)
168
168
  (1..5).each do |i|
169
169
  assert_equal(sample.shift, complex.include?(i))
170
170
  end
171
171
 
172
172
  sample = [true, true, true, true, true]
173
173
  complex = When::Parts::GeometricComplex.new(true)
174
- assert_equal(nil, complex.exclude_end?)
174
+ assert_nil(complex.exclude_end?)
175
175
  (1..5).each do |i|
176
176
  assert_equal(sample.shift, complex.include?(i))
177
177
  end
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  =begin
3
- Copyright (C) 2012-2014 Takashi SUGA
3
+ Copyright (C) 2012-2021 Takashi SUGA
4
4
 
5
5
  You may use and/or modify this file according to the license
6
6
  described in the LICENSE.txt file included in this archive.
@@ -212,12 +212,12 @@ module MiniTest
212
212
  ["*", 17, 18, 19, 20, 21, 22, 23],
213
213
  ["*", 24, 25, 26, 27, 28, 29, 30],
214
214
  ["*", 31, "*", "*", "*", "*", "*", "*"]]]]],
215
- date.year_included('Sunday') {|d,b|
216
- case b
217
- when When::YEAR ; d[When::YEAR]
218
- when When::MONTH ; d[When::MONTH]
219
- when When::DAY ; d[When::DAY]
220
- else ; '*'
215
+ date.year_included('Sunday') {|d,b|
216
+ case b
217
+ when When::YEAR ; d[When::YEAR]
218
+ when When::MONTH ; d[When::MONTH]
219
+ when When::DAY ; d[When::DAY]
220
+ else ; '*'
221
221
  end
222
222
  }
223
223
  )
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  =begin
3
- Copyright (C) 2011-2015 Takashi SUGA
3
+ Copyright (C) 2011-2018 Takashi SUGA
4
4
 
5
5
  You may use and/or modify this file according to the license
6
6
  described in the LICENSE.txt file included in this archive.
@@ -86,5 +86,18 @@ module MiniTest
86
86
  date = When.when? '1936-11%3C08-%5E%5eHinduLuniSolar?note=HinduNote&location=(_co:Indian::Chennai)&start_month=5&type=SBSA'
87
87
  assert_equal('1936-11<08-', date.to_s)
88
88
  end
89
+
90
+ def test_vikram_sambat
91
+ date = When.when? '1942.4.20'
92
+ mismatches = []
93
+ 961.times do
94
+ sambat = (When::VikramSambatSolar ^ date).to_s
95
+ samvat = (When::VikramSamvatSolar ^ date).to_s
96
+ mismatches << [date.to_s, sambat, samvat] unless sambat == samvat
97
+ date += When::P1M
98
+ end
99
+ assert_equal([%w(1945-11-20 2002-08-06 2002-08-05)], mismatches)
100
+ end
101
+
89
102
  end
90
103
  end
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  =begin
3
- Copyright (C) 2011-2014 Takashi SUGA
3
+ Copyright (C) 2011-2017 Takashi SUGA
4
4
 
5
5
  You may use and/or modify this file according to the license
6
6
  described in the LICENSE.txt file included in this archive.
@@ -48,6 +48,16 @@ module MiniTest
48
48
  end
49
49
  end
50
50
  end
51
+
52
+ def test_ummalqura_solar
53
+ date = When.when? '2017.9.23'
54
+ assert_equal('1396-01-01', (When::UmmalquraSolar ^ date).to_s)
55
+ 399.times do
56
+ date += When::P1Y
57
+ assert_equal([1,1], (When::UmmalquraSolar ^ date).cal_date[-2..-1])
58
+ end
59
+ end
60
+
51
61
  end
52
62
  end
53
63
 
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  =begin
3
- Copyright (C) 2011-2014 Takashi SUGA
3
+ Copyright (C) 2011-2020 Takashi SUGA
4
4
 
5
5
  You may use and/or modify this file according to the license
6
6
  described in the LICENSE.txt file included in this archive.
@@ -208,11 +208,11 @@ module MiniTest
208
208
  def test__eclipse
209
209
  date = When.when?('貞観4.2.1')
210
210
  assert_equal('夜日蝕七分', date.notes({:notes=>'日食'}).value)
211
- assert_equal(nil, date.notes({:notes=>'日食', :solar_eclipse=>1}).value)
211
+ assert_nil(date.notes({:notes=>'日食', :solar_eclipse=>1}).value)
212
212
 
213
213
  date = When.when?('貞観4.2.15')
214
214
  assert_equal('(月蝕ニ分)', date.notes({:notes=>'月食'}).value)
215
- assert_equal(nil, date.notes({:notes=>'月食', :lunar_eclipse=>3}).value)
215
+ assert_nil(date.notes({:notes=>'月食', :lunar_eclipse=>3}).value)
216
216
  end
217
217
 
218
218
  def test_japanese_lunisolar
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  =begin
3
- Copyright (C) 2011-2015 Takashi SUGA
3
+ Copyright (C) 2011-2020 Takashi SUGA
4
4
 
5
5
  You may use and/or modify this file according to the license
6
6
  described in the LICENSE.txt file included in this archive.
@@ -171,7 +171,7 @@ module MiniTest
171
171
  date, verify = sample
172
172
  list = When.when?(date).to_h({:method=>:to_m17n, :locale=>verify[:locale], :prefix=>true})
173
173
  [:calendar, :cal_date, :sdn, :clk_time].each do |key|
174
- assert_equal(verify[key], list[key])
174
+ assert_equal([verify[key]], [list[key]])
175
175
  end
176
176
  verify[:notes].each_index do |i|
177
177
  verify[:notes][i].each_index do |k|
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  =begin
3
- Copyright (C) 2014 Takashi SUGA
3
+ Copyright (C) 2014-2017 Takashi SUGA
4
4
 
5
5
  You may use and/or modify this file according to the license
6
6
  described in the LICENSE.txt file included in this archive.
@@ -103,7 +103,7 @@ module MiniTest
103
103
 
104
104
  class HankeHenry < MiniTest::TestCase
105
105
  def test_hanke_henry
106
- assert_equal(When.when?('2012.1.1').to_i, When.when?('2012.1.1^^HankeHenry').to_i)
106
+ assert_equal(When.when?('2018.1.1').to_i, When.when?('2018.1.1^^HankeHenry').to_i)
107
107
  count = 0
108
108
  (2000...2400).each do |year|
109
109
  first = When.tm_pos(year, 1, 1)
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  =begin
3
- Copyright (C) 2011-2016 Takashi SUGA
3
+ Copyright (C) 2011-2021 Takashi SUGA
4
4
 
5
5
  You may use and/or modify this file according to the license
6
6
  described in the LICENSE.txt file included in this archive.
@@ -55,9 +55,9 @@ LIST
55
55
  assert_equal("2001-08-02..2001-09-10", When.when?("2001-08-02/09-10").to_s)
56
56
  assert_equal(364, When.when?('20130101/1230').count) if Enumerable.method_defined?(:count)
57
57
  assert_equal("1980-02-01", When.when?("800201", {:abbr=>1970}).to_s)
58
- # assert_equal(nil, When.TemporalPosition(2011,2,29))
58
+ # assert_nil(When.TemporalPosition(2011,2,29))
59
59
  assert_equal('2011-03-01', When.TemporalPosition(2011,2,29).to_s)
60
- assert_equal(nil, When.TemporalPosition(2011,2,29, {:invalid=>:check}))
60
+ assert_nil(When.TemporalPosition(2011,2,29, {:invalid=>:check}))
61
61
  assert_raises(ArgumentError) { When.TemporalPosition(2011,2,29, {:invalid=>:raise}) }
62
62
  end
63
63
 
@@ -65,7 +65,7 @@ LIST
65
65
  assert_equal('1950-08', When.strptime('1950 Aug', '%Y %B').to_s)
66
66
  assert_equal('1950-08-31', When.strptime('1950 Aug 31', '%Y %B %d').to_s)
67
67
  assert_equal('2015-01-06T09:18:24+09:00', When.strptime('Tue Jan 6 9:18:24 +09:00 2015', "%A %B %d %H:%M:%S %z %Y").to_s)
68
- assert_equal('2016-01-07T09:18:24+09:00', When.strptime("木 1月 6 9:18:24 JST", "%A %B %d %H:%M:%S %z", {:locale=>'ja'}).to_s)
68
+ assert_equal('2021-01-07T09:18:24+09:00', When.strptime("木 1月 6 9:18:24 JST", "%A %B %d %H:%M:%S %z", {:locale=>'ja'}).to_s)
69
69
  assert_raises(ArgumentError) {When.strptime("Thu Jan 6 9:18:24 +09:00 2015", "%A %B %d %H:%M:%S %z %Y", {:invalid=>:raise})}
70
70
  end
71
71
 
@@ -156,7 +156,7 @@ LIST
156
156
  assert_equal('平成26(2014).08.21', When.tm_pos('平成', When.Residue('甲午'), 8, When.Residue('甲子')).to_s)
157
157
 
158
158
  assert_equal('2014-09-06', When.tm_pos(2014, 8, When.Residue('SA:6')).to_s)
159
- assert_equal(nil, When.tm_pos(2014, 8, When.Residue('SA:6'), :invalid=>:check))
159
+ assert_nil(When.tm_pos(2014, 8, When.Residue('SA:6'), :invalid=>:check))
160
160
  assert_raises(ArgumentError) {When.tm_pos(2014, 8, When.Residue('SA:6'), :invalid=>:raise)}
161
161
  end
162
162
 
@@ -173,10 +173,10 @@ LIST
173
173
  assert_equal('2015-12-25', When.when?('2015-01-01{Christian#christmas}').to_s)
174
174
  assert_equal('2015-09-22T00:00+09:00', When.when?('2015-09-01{SolarTerms#term180-1&TU}T00:00+09:00').to_s)
175
175
  assert_equal('2015-05-06', When.when?('2015-05-{06&MO,TU,WE}').to_s)
176
- assert_equal(nil, When.when?('2016-05-{06&MO,TU,WE}'))
176
+ assert_nil(When.when?('2016-05-{06&MO,TU,WE}'))
177
177
 
178
178
  assert_equal('2015-03-01', When.when?('2015-02-01{5SU}').to_s)
179
- assert_equal(nil, When.when?('2015-02-{5SU}'))
179
+ assert_nil(When.when?('2015-02-{5SU}'))
180
180
  assert_equal('2015-02-22', When.when?('2015-02-{-SU}').to_s)
181
181
 
182
182
  it = When.when?('R/2015-09-01{SolarTerms#term180-1&TU}T00:00+09:00')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: when_exe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi SUGA
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-18 00:00:00.000000000 Z
11
+ date: 2021-05-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A multicultural and multilingualized calendar library based on ISO 8601,
14
14
  ISO 19108, RFC 5545(iCalendar) and RFC6350. JSON-LD formats for TemporalPosition
@@ -216,6 +216,7 @@ files:
216
216
  - lib/when_exe/region/roman.rb
217
217
  - lib/when_exe/region/russian.rb
218
218
  - lib/when_exe/region/ryukyu.rb
219
+ - lib/when_exe/region/saudi_arabian.rb
219
220
  - lib/when_exe/region/shire.rb
220
221
  - lib/when_exe/region/symmetry.rb
221
222
  - lib/when_exe/region/thai.rb
@@ -343,7 +344,7 @@ files:
343
344
  homepage: http://www.asahi-net.or.jp/~dd6t-sg/
344
345
  licenses: []
345
346
  metadata: {}
346
- post_install_message:
347
+ post_install_message:
347
348
  rdoc_options: []
348
349
  require_paths:
349
350
  - lib
@@ -358,11 +359,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
358
359
  - !ruby/object:Gem::Version
359
360
  version: '0'
360
361
  requirements: []
361
- rubyforge_project:
362
- rubygems_version: 2.4.5
363
- signing_key:
362
+ rubygems_version: 3.2.3
363
+ signing_key:
364
364
  specification_version: 4
365
365
  summary: A multicultural and multilingualized calendar library based on ISO 8601,
366
366
  ISO 19108, RFC 5545(iCalendar) and RFC6350
367
367
  test_files: []
368
- has_rdoc: