nanakshahi 0.1.9 → 0.3.1

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: cf652ae1baa2a9e260f827e3a2b7942fc7c95bb264e000b5b59a3c1e01b10f45
4
- data.tar.gz: 78d318348c2b62d737acc7eb84ba794236dc578d3449efafe13a3fe8257071c2
3
+ metadata.gz: a0463259484c7c4dc42a9cca224c2aa0f92c973bf15cface244fbd8737d56428
4
+ data.tar.gz: 156097925d4f56d5eaf3e3cc7e51fc57f5f14168b8eca053b0aac4418fdf3d48
5
5
  SHA512:
6
- metadata.gz: '084132ba26de3b00969415f8c9d41a78176f7f2749aba37e5a9edd03043b9b11bb4feadcc74a78edff5e0565ce553f462fc07b62f99fc7aa2a8b91b6f5b91345'
7
- data.tar.gz: 210eef669c266262af2b6d7594cd5573f9366546c94b760898bcc4b40fd9e60da5e9fcb5bbe8ba370cb9cee1c642491be658c936bd6e3dd87034361afa77a13d
6
+ metadata.gz: 7615dbb96309c2aa058fdf5659c32d288951014662c286acdd51d5eb1f01833d13a16dae366d9d4fcf837bc6bbea5383d2adc3fce39f4121e5e7530066ebdd7f
7
+ data.tar.gz: 81b05d9eabfcedaff95c2677f5aa545ed2c25ccb8643cc3e0fd4f129ae2a4903a9630542b5204ca234414a944b231242794e937f6ce2daafcb905b4e66b675be
data/CHANGELOG.md CHANGED
@@ -1,4 +1,20 @@
1
1
  # coding: UTF-8
2
+ === 0.3 / 2021-09-20
3
+
4
+ Features:
5
+
6
+ - Now supports Shahmukhi Script of Panjabi language via `to_shahmukhi` method
7
+
8
+ Bug fixes:
9
+ - Fixed a bug which returned incorrect `to_gregorian method`
10
+
11
+ === 0.2.0 / 2021-09-12
12
+
13
+ Bug fixes:
14
+
15
+ - Updated rake 13.0.6 (was 13.0.1)
16
+ - Updated minitest 5.14.4 (was 5.14.0)
17
+ - Updated i18n 1.8.10 (was 1.8.2)
2
18
 
3
19
  === 0.1.9 / 2020-04-15
4
20
 
data/Gemfile.lock CHANGED
@@ -1,17 +1,17 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nanakshahi (0.1.9)
4
+ nanakshahi (0.2.0)
5
5
  i18n (~> 1.8, >= 1.8.1)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- concurrent-ruby (1.1.6)
11
- i18n (1.8.2)
10
+ concurrent-ruby (1.1.9)
11
+ i18n (1.8.10)
12
12
  concurrent-ruby (~> 1.0)
13
- minitest (5.14.0)
14
- rake (13.0.1)
13
+ minitest (5.14.4)
14
+ rake (13.0.6)
15
15
 
16
16
  PLATFORMS
17
17
  ruby
@@ -23,4 +23,4 @@ DEPENDENCIES
23
23
  rake (~> 13.0)
24
24
 
25
25
  BUNDLED WITH
26
- 2.1.4
26
+ 2.2.22
data/README.md CHANGED
@@ -1,8 +1,9 @@
1
- # ਨਾਨਕਸ਼ਾਹੀ (Nanakshahi)
1
+ ਨਾਨਕਸ਼ਾਹੀ (Nanakshahi)[![Gem Version](https://badge.fury.io/rb/nanakshahi.svg)](https://badge.fury.io/rb/nanakshahi) ![Build Status](https://github.com/akaltakht/nanakshahi/actions/workflows/gempush.yml/badge.svg)
2
+ ========
2
3
 
3
4
  ਨਾਨਕਸ਼ਾਹੀ ਇੱਕ ਰੂਬੀ ਪਰੋਗਰਾਮਿੰਗ ਭਾਸ਼ਾ ਚ ਲਿਖਿਆ ਗਿਆ gem ਹੈ ਜੋ ਕਿ [ਪਾਲ ਸਿੰਘ ਪੁਰੇਵਾਲ](http://purewal.biz/) ਦੁਆਰਾ ਲਿਖੇ ਗਏ [ਮੂਲ ਨਾਨਕਸ਼ਾਹੀ ਕਲੰਡਰ](http://www.purewal.biz/Gurbani_and_Nanakshahi_Calendar.pdf) ਤੇ ਅਧਾਰਿਤ ਹੈ।
4
5
 
5
- ਇਹ ਆਮ/ਗਰਿਗੋਰੀਅਨ ਕਲੰਡਰ ਦੀਆਂ ਤਰੀਕਾਂ ਤੋਂ ਨਾਨਕਸ਼ਾਹੀ ਤੇ ਵਾਪਸ ਬਦਲਣ ਦੇ ਤਰੀਕੇ ਮੁਹੱੲੀਆ ਕਰਵਾਉਂਦਾ ਹੈ। ਤੁਸੀਂ ਇਸ ਨੂੰ ਕਿਸੇ ਵੀ ਰੂਬੀ ਪਰੋਗਰਾਮ ਵਿੱਚ ਨਾਨਕਸ਼ਾਹੀ ਤਰੀਕਾਂ ਵਰਤਣ ਲੲੀ ਵਰਤ ਸਕਦੇ ਹੋ।
6
+ ਇਹ ਆਮ/ਗਰਿਗੋਰੀਅਨ ਕਲੰਡਰ ਦੀਆਂ ਤਰੀਕਾਂ ਤੋਂ ਨਾਨਕਸ਼ਾਹੀ ਤੇ ਵਾਪਸ ਬਦਲਣ ਦੇ ਤਰੀਕੇ ਮੁਹੱਈਆ ਕਰਵਾਉਂਦਾ ਹੈ। ਤੁਸੀਂ ਇਸ ਨੂੰ ਕਿਸੇ ਵੀ ਰੂਬੀ ਪਰੋਗਰਾਮ ਵਿੱਚ ਨਾਨਕਸ਼ਾਹੀ ਤਰੀਕਾਂ ਵਰਤਣ ਲਈ ਵਰਤ ਸਕਦੇ ਹੋ।
6
7
 
7
8
  Nanakshahi is a ruby gem for Nanakshahi Calendar based on the [original work](http://www.purewal.biz/Gurbani_and_Nanakshahi_Calendar.pdf) by [Pal Singh Purewal](http://purewal.biz/).
8
9
 
@@ -36,21 +37,19 @@ require 'nanakshahi'
36
37
 
37
38
  ```ruby
38
39
  date = Nanakshahi.new # Creates an object with 1 Chet, Nanakshahi
39
- date = Nanakshahi.new(550)
40
- date = Nanakshahi.new(550, 10)
41
- date = Nanakshahi.new(550, 10, 5)
40
+ date = Nanakshahi.new(553)
41
+ date = Nanakshahi.new(553, 7)
42
+ date = Nanakshahi.new(550, 7, 6)
43
+ date = Nanakshahi.today
42
44
  ```
43
45
 
44
46
  ### Using common calendar/gregorian date
45
47
 
46
48
  ```ruby
47
- date = Nanakshahi.from_gregorian(2019,1,8)
48
- ```
49
-
50
- ### Nanakshahi date today
51
-
52
- ```ruby
53
- date = Nanakshahi.today
49
+ date = Nanakshahi.from_gregorian(2021,9,21)
50
+ => #<Nanakshahi:0x00007fbec18410e8 @day=7, @month=7, @year=553>
51
+ ndate = date.to_gregorian
52
+ => #<Date: 2021-09-21 ((2459479j,0s,0n),+0s,2299161j)>
54
53
  ```
55
54
 
56
55
  ### Is it a gurpurab?
@@ -76,6 +75,8 @@ p date.to_nanakshahi
76
75
 
77
76
  ### Printing Nanakshahi date
78
77
 
78
+ #### Roman
79
+
79
80
  `to_s` method prints Nanakshahi date either Nanakshahi or Dhundkaal suffix (pre-Guru Nanak). To take care of 0 year correction, like gregorian, it is assumed that 1 Dhundkaal precedes 1 Nanakshahi when printed with suffix.
80
81
 
81
82
  ```ruby
@@ -83,7 +84,7 @@ date = Nanakshahi.new(1400-2-18)
83
84
  puts date
84
85
  ```
85
86
 
86
- ### To Gurmukhi
87
+ #### Gurmukhi
87
88
 
88
89
  `to_gurmukhi` prints the date in Gurmukhi characters, complete with Gurmukhi numerals.
89
90
 
@@ -92,11 +93,31 @@ date = Nanakshahi.new(1400-2-18)
92
93
  puts date.to_gurmukhi
93
94
  ```
94
95
 
96
+ #### Shahmukhi
97
+
98
+ `to_shahmukhi` prints the date in Shahmukhi characters, complete with Shahmukhi numerals.
99
+
100
+ ```ruby
101
+ date = Nanakshahi.today
102
+ puts date.to_shahmukhi
103
+ ```
104
+
105
+ ### Recommendations
106
+ The following was not part of the seminal work by Pal Singh Purewal, but constituted part of recommendations in our paper [Building an Open-Source Nanakshahi Calendar: Identity and a Spiritual and Computational Journey(Singh et al., 2020)](https://sikhresearchjournal.org/building-an-open-source-nanakshahi-calendar-identity-and-a-spiritual-and-computational-journey-by-arvinder-singh-amandeep-singh-amarpreet-singh-harvinder-singh-parm-singh/)
107
+
108
+ ### Dhundkaal - The era of the fog
109
+
110
+ ```ruby
111
+ date = Nanakshahi.from_gregorian(1468,1,1)
112
+ date.to_s
113
+ => "19 Poh, 2 Dhundkaal"
114
+ ```
115
+
95
116
  For a complete list of all the methods, check out [the documentation](https://www.rubydoc.info/gems/nanakshahi).
96
117
 
97
118
  ## Contributing
98
119
 
99
- Bug reports and pull requests are welcome on GitHub at https://github.com/punjab/nanakshahi.
120
+ Bug reports and pull requests are welcome on GitHub at https://github.com/akaltakht/nanakshahi.
100
121
 
101
122
  ## License
102
123
 
@@ -0,0 +1,34 @@
1
+ pa_PK:
2
+ nanakshahi_months:
3
+ -
4
+ - چیت
5
+ - وساکھ
6
+ - جیٹھ
7
+ - ہاڑھ
8
+ - ساؤݨ
9
+ - بھادوں
10
+ - اسو
11
+ - کتک
12
+ - مگھر
13
+ - پوہ
14
+ - ماگھ
15
+ - پھگݨ
16
+ digits:
17
+ - ۰
18
+ - ۱
19
+ - ۲
20
+ - ۳
21
+ - ۴
22
+ - ۵
23
+ - ۶
24
+ - ۷
25
+ - ۸
26
+ - ۹
27
+ day_names:
28
+ - سوم وار
29
+ - منگل
30
+ - بدھ
31
+ - جمعرات
32
+ - شکروار
33
+ - سن
34
+ - اتوار
@@ -1,3 +1,3 @@
1
1
  class Nanakshahi
2
- VERSION = "0.1.9"
2
+ VERSION = "0.3.1"
3
3
  end
data/lib/nanakshahi.rb CHANGED
@@ -15,7 +15,7 @@ require "nanakshahi/gurpurab"
15
15
  # @attr_reader [Integer] day Day part of Nanakshahi date object
16
16
  class Nanakshahi
17
17
  I18n.load_path << Dir[File.expand_path("config/locales") + "/*.yml"]
18
- I18n.available_locales = [:en, :pa]
18
+ I18n.available_locales = [:en, :pa, :pa_PK]
19
19
  include Comparable
20
20
  extend Utils
21
21
  extend Grid
@@ -42,15 +42,7 @@ class Nanakshahi
42
42
  #
43
43
  # @return [Date] Converts nanakshahi into corresponding gregorian# as Date object
44
44
  def to_gregorian
45
- last_nmonth_of_gyear = 10 # ਪੋਹ
46
- last_nday_of_gyear = 18 # ੧੮
47
-
48
- if month <= last_nmonth_of_gyear && day <= last_nday_of_gyear
49
- gyear = year + 1468
50
- else
51
- gyear = year + 1469
52
- end
53
-
45
+ gyear = year + 1468
54
46
  nanakshahi_months = self.class.date_grid(gyear)
55
47
  nanakshahi_months[month - 1][day - 1]
56
48
  end
@@ -71,6 +63,14 @@ class Nanakshahi
71
63
  "#{panjabi_numerals(day)} #{I18n.t(:nanakshahi_months, locale: :pa)[month]}, #{panjabi_numerals(year_zero_correction(year))} #{era}"
72
64
  end
73
65
 
66
+ # Shahmukhi String representation of Nanakshahi object
67
+ #
68
+ # @return [String] Shahmukhi String representation of Nanakshahi
69
+ def to_shahmukhi
70
+ era = year < 1 ? :دھندکال : :نانکشاھی
71
+ "#{shahmukhi_numerals(day)} #{I18n.t(:nanakshahi_months, locale: :pa_PK)[month]} #{shahmukhi_numerals(year_zero_correction(year))} #{era} "
72
+ end
73
+
74
74
  # Checks Nanakshahi leap year
75
75
  #
76
76
  # @return [Boolean] True if Nanakshahi year's Phagun has 31 days
@@ -157,4 +157,13 @@ class Nanakshahi
157
157
  def panjabi_numerals(number)
158
158
  number.to_s.chars.map { |digit| I18n.t(:digits, locale: :pa)[digit.to_i] }.join
159
159
  end
160
+
161
+ # Converts english numerals to Shahmukhi
162
+ #
163
+ # @param [Integer] number A numeric usually date
164
+ # @return [String] Shahmukhi representation of date
165
+ # @private
166
+ def shahmukhi_numerals(number)
167
+ number.to_s.chars.map { |digit| I18n.t(:digits, locale: :pa_PK)[digit.to_i] }.join
168
+ end
160
169
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanakshahi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arvinder Singh
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-16 00:00:00.000000000 Z
11
+ date: 2021-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -94,6 +94,7 @@ files:
94
94
  - bin/setup
95
95
  - config/locales/en.yml
96
96
  - config/locales/pa.yml
97
+ - config/locales/pa_PK.yml
97
98
  - lib/nanakshahi.rb
98
99
  - lib/nanakshahi/date.rb
99
100
  - lib/nanakshahi/grid.rb
@@ -120,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
121
  - !ruby/object:Gem::Version
121
122
  version: '0'
122
123
  requirements: []
123
- rubygems_version: 3.1.2
124
+ rubygems_version: 3.1.6
124
125
  signing_key:
125
126
  specification_version: 4
126
127
  summary: Nanakshahi calendar by Pal Singh Purewal