go_time 0.2.1 → 0.2.2

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: b80f6922da9c84cf643b10d7c417e0b853506a7736e1817f56515a3199c259d5
4
- data.tar.gz: 154a27679e95f6d1f9690bf31e43656f498e9fbc25629348abd46743093ac4e8
3
+ metadata.gz: 62649a3728b881a187b666a9f060df1003df0d9479e8aba2e018529ec493ea70
4
+ data.tar.gz: ec90a45596bba2d942340ea14a78b5920eafd1cbe18afad56d85af7306e726cd
5
5
  SHA512:
6
- metadata.gz: 83ed074e085cf895831a2f94bb9a9e2d407f02ba07af89ec5ad0bd9247207958aa8a578804e6a6a502b94de47a7a719fef1f36adfecca4cda6f91260aa64aba2
7
- data.tar.gz: 2b4fef8475bfdb4be6db5521b77078a6726b7b917a9db7cb825c1431c904e237ed1044f9be94df227e3082b710028fbef6d7352bd1aba5eecada1ad2779a39dc
6
+ metadata.gz: 31c892a6d5dd6a69f68b8e1ee7cf11a90420a493ac1c917fe126af8f7a509ef3a73a84b789897149a6b295cb70f3713e11b32ad2c56cb6761168640a4ee3caba
7
+ data.tar.gz: 7ec674c882bd80728c47e88a626e227575eba63c3b4ca2256fae73a05a304bd39e3d31956c52f87c8da91744798ac5b65d6eb05d1dcc8c4b4d0dfba3dfb31d8f
data/README.md CHANGED
@@ -69,8 +69,8 @@ GoTime has extensions that support date and time representations in various lang
69
69
  ```ruby
70
70
  require "go_time/ext/ja" # Japanese
71
71
  time = Time.utc(2019, 5, 6, 7, 8, 9)
72
- time.strftime("平成十八年(二〇〇六年)一月二日(火) 午後三時四分五秒")
73
- # => "令和元年(二〇一九年)五月六日(月) 午前七時八分九秒"
72
+ GoTime.strftime(time, "平成十八年(二〇〇六年)一月二日(火) 午後三時四分五秒")
73
+ # => "令和元年(二〇一九年)五月六日(月) 午前七時八分九秒"
74
74
  ```
75
75
 
76
76
  ## Development
@@ -39,6 +39,7 @@ module GoTime
39
39
  }.freeze
40
40
 
41
41
  def self.japanese_year(time)
42
+ time = time.to_time if time.respond_to?(:to_time)
42
43
  if time >= Time.new(2019, 4, 30)
43
44
  ["令和", time.year - 2018]
44
45
  elsif time >= Time.new(1989, 1, 8)
@@ -1,3 +1,3 @@
1
1
  module GoTime
2
- VERSION = -"0.2.1"
2
+ VERSION = -"0.2.2"
3
3
  end
data/lib/go_time.rb CHANGED
@@ -51,7 +51,7 @@ module GoTime
51
51
  def self.convert(fmt, exception: false)
52
52
  ret = fmt.gsub(BASIC_CONVERT_REGEXP, BASIC_CONVERT_TABLE)
53
53
  if exception
54
- matched = ret.match(@convert_regexp)
54
+ matched = ret.match(Regexp.union(@convert_table.keys - BASIC_CONVERT_TABLE.keys))
55
55
  raise ArgumentError, %(unsupported syntax "#{matched}") if matched
56
56
  end
57
57
  ret
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: go_time
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - nodai2hITC
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-29 00:00:00.000000000 Z
11
+ date: 2022-01-30 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Formats Time according to Go-like format like "01/02 03:04:05PM '06 -0700"
14
14
  email: