japanese_calendar 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -1
- data/japanese_calendar.gemspec +3 -0
- data/lib/japanese_calendar/era.rb +7 -6
- data/lib/japanese_calendar/version.rb +1 -1
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 911eaaf3d1894319e9d2f7349c303fa236f7c7eb
|
4
|
+
data.tar.gz: 3a240bb75f650ab1559123df1272e66deff033a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1135f2ec0097a8c9763bc4ef9e048241d24449f9e195de64ade0e54e045c479065588d2ebdeb8ad82dc5803a0df2cf0b1ab6c93abc1e401b3515864295f0dbb7
|
7
|
+
data.tar.gz: 7ed0a7ec12be84cb46a8a0f58dff1b444272b5c0c9466a18c01d073215a5476c229cd0dee185db0bfc0db3b95371e5effb999d158ec1662c8944c3ff2c8893e0
|
data/.travis.yml
CHANGED
data/japanese_calendar.gemspec
CHANGED
@@ -21,9 +21,12 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ["lib"]
|
23
23
|
|
24
|
+
spec.required_ruby_version = ">= 2.1"
|
25
|
+
|
24
26
|
spec.add_development_dependency "bundler", "~> 1.13"
|
25
27
|
spec.add_development_dependency "rake", "~> 10.0"
|
26
28
|
spec.add_development_dependency "rspec", "~> 3.0"
|
29
|
+
spec.add_development_dependency "rubocop"
|
27
30
|
spec.add_development_dependency "simplecov"
|
28
31
|
spec.add_development_dependency "codeclimate-test-reporter", "~> 1.0.0"
|
29
32
|
end
|
@@ -61,20 +61,19 @@ module JapaneseCalendar
|
|
61
61
|
# Time.new(1872, 12, 31).strftime("%K%-J年") # => RuntimeError
|
62
62
|
def strftime(format)
|
63
63
|
string = format.dup
|
64
|
+
string.gsub!(/%K/, era_name)
|
65
|
+
string.gsub!(/%O/, era_name(:romaji))
|
66
|
+
string.gsub!(/%\^O/, era_name(:romaji).upcase)
|
67
|
+
string.gsub!(/%o/, era_name(:romaji)[0])
|
64
68
|
string.gsub!(/%J/, "%02d" % era_year)
|
65
69
|
string.gsub!(/%-J/, "%d" % era_year)
|
66
70
|
string.gsub!(/%_J/, "%2d" % era_year)
|
67
|
-
string.gsub!(/%K/, era_name.to_s)
|
68
|
-
string.gsub!(/%O/, era_name(:romaji).to_s)
|
69
|
-
string.gsub!(/%\^O/, era_name(:romaji).upcase.to_s)
|
70
|
-
string.gsub!(/%o/, era_name(:romaji)[0].to_s)
|
71
71
|
super(string)
|
72
72
|
end
|
73
73
|
|
74
74
|
private
|
75
|
-
Period = Struct.new(:beginning_of_period, :kanji_name, :romaji_name)
|
76
75
|
|
77
|
-
|
76
|
+
Period = Struct.new(:beginning_of_period, :kanji_name, :romaji_name)
|
78
77
|
|
79
78
|
PERIODS = [
|
80
79
|
Period.new(Time.new(1989, 1, 8), "平成", "Heisei").freeze,
|
@@ -83,6 +82,8 @@ module JapaneseCalendar
|
|
83
82
|
Period.new(Time.new(1868, 1, 25), "明治", "Meiji" ).freeze
|
84
83
|
].freeze
|
85
84
|
|
85
|
+
MEIJI_6 = Time.new(1873, 1, 1)
|
86
|
+
|
86
87
|
def current_era
|
87
88
|
error_proc = proc { raise "#{self.class.name.downcase} out of range" }
|
88
89
|
error_proc.call if self < MEIJI_6
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: japanese_calendar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryo Yamamoto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: simplecov
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -119,7 +133,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
119
133
|
requirements:
|
120
134
|
- - ">="
|
121
135
|
- !ruby/object:Gem::Version
|
122
|
-
version: '
|
136
|
+
version: '2.1'
|
123
137
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
138
|
requirements:
|
125
139
|
- - ">="
|
@@ -127,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
141
|
version: '0'
|
128
142
|
requirements: []
|
129
143
|
rubyforge_project:
|
130
|
-
rubygems_version: 2.
|
144
|
+
rubygems_version: 2.6.8
|
131
145
|
signing_key:
|
132
146
|
specification_version: 4
|
133
147
|
summary: Japanese calendar utility for Ruby
|