solar_terms_24 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +7 -3
- data/lib/solar_terms_24/cli.rb +1 -1
- data/lib/solar_terms_24/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53d4cbf868874c299990294354e75867efcfa3acbd0cc4fe94145613ad805bae
|
4
|
+
data.tar.gz: 6fe4eb41ba5ad2e4640e9ce02d7f7d030412f54962a07792aa90ab79a18e2b1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fce29ee1482edfedaf9ff737e0b3f9694d4abf46bde7490f12113f8380a68677f3f3371d71ff26ed9270081932e35d2033f4b936a685d770d294f090bb31a517
|
7
|
+
data.tar.gz: b53680779e6b8401fc8dfd2867ac3488f16c8823f09483b609ca6f0fa94da30babdf922e50ba1eace768f18671437cac73a027437e0c05af64c73c466cf87534
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/solar_terms_24.svg)](https://badge.fury.io/rb/solar_terms_24)
|
2
|
+
[![Ruby](https://github.com/kevinluo201/solar_terms_24/actions/workflows/main.yml/badge.svg)](https://github.com/kevinluo201/solar_terms_24/actions/workflows/main.yml)
|
1
3
|
# SolarTerms24
|
2
4
|
|
3
5
|
## Introduction
|
@@ -96,7 +98,7 @@ $ solar_terms_24 list 2022 --timezone=Asia/Taipei --lang=zh-TW
|
|
96
98
|
# 冬至: 2022-12-22 05:48
|
97
99
|
```
|
98
100
|
### In code
|
99
|
-
|
101
|
+
You can use `SolarTerms24::SolarTerms` to grab solar terms information of a year.
|
100
102
|
```ruby
|
101
103
|
year = 2022
|
102
104
|
solar_terms = SolarTerms24::SolarTerms.new(year)
|
@@ -109,7 +111,9 @@ solar_term.date.strftime('%Y-%m-%d')
|
|
109
111
|
solar_term.datetime.strftime('%Y-%m-%d %H:%M:%S')
|
110
112
|
# => 2022-12-21 21:48:14
|
111
113
|
# => solar_term.datetime is a DateTime object
|
112
|
-
|
114
|
+
```
|
115
|
+
To specify different timezones and languages, for example, `Asia/Taipei` and `zh-TW`
|
116
|
+
```ruby
|
113
117
|
solar_terms = SolarTerms24::SolarTerms.new(year, timezone: 'Asia/Taipei', lang: 'zh-TW')
|
114
118
|
solar_term = solar_terms.winter_solstice
|
115
119
|
solar_term.name
|
@@ -134,7 +138,7 @@ These are the supported languages:
|
|
134
138
|
|
135
139
|
### Timezone
|
136
140
|
|
137
|
-
It uses the gem [tzinfo], so all timezones in [IANA Time Zone Database](http://www.iana.org/time-zones) are supported. For example,
|
141
|
+
It uses the gem [tzinfo](https://github.com/tzinfo/tzinfo), so all timezones in [IANA Time Zone Database](http://www.iana.org/time-zones) are supported. For example,
|
138
142
|
* UTC (default)
|
139
143
|
* Asia/Ho_Chi_Minh
|
140
144
|
* Asia/Seoul
|
data/lib/solar_terms_24/cli.rb
CHANGED
@@ -9,7 +9,7 @@ module SolarTerms24
|
|
9
9
|
option :lang, type: :string, default: 'en', desc: 'Language: en, zh-TW, or ja'
|
10
10
|
option :timezone, type: :string, default: 'UTC', desc: 'Timezone: UTC, Asia/Taipei, Asia/Tokyo, etc.'
|
11
11
|
def list(year)
|
12
|
-
solar_terms = SolarTerms.new(year, timezone: options[:timezone], lang: options[:lang])
|
12
|
+
solar_terms = SolarTerms.new(year.to_i, timezone: options[:timezone], lang: options[:lang])
|
13
13
|
solar_terms.solar_terms.each_value do |solar_term|
|
14
14
|
puts "#{solar_term.name}: #{solar_term.datetime.strftime("%Y-%m-%d %H:%M")}"
|
15
15
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solar_terms_24
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kevinluo201
|
@@ -375,8 +375,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
375
375
|
- !ruby/object:Gem::Version
|
376
376
|
version: '0'
|
377
377
|
requirements: []
|
378
|
-
rubygems_version: 3.
|
378
|
+
rubygems_version: 3.4.1
|
379
379
|
signing_key:
|
380
380
|
specification_version: 4
|
381
|
-
summary: "`solar_terms_24` calculates and collects 24 solar terms each year
|
381
|
+
summary: "`solar_terms_24` calculates and collects 24 solar terms each year by using
|
382
|
+
NASA JPL Horizons System API."
|
382
383
|
test_files: []
|