bahai_date 1.3.1 → 1.4.0

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
  SHA1:
3
- metadata.gz: b314d07af6b210455674a6281aff0b20b1651aeb
4
- data.tar.gz: 2db23403ea9cc4ce0f40fd1eded6775f950c551c
3
+ metadata.gz: ddea524624d41ac9fd0e83c861dec4d752ce10c3
4
+ data.tar.gz: c65ee6492cbd2b33d6471c81bbcdbbb7ab701862
5
5
  SHA512:
6
- metadata.gz: cb42255ee1a47297668ca07a4a0f21ec97a401c20c78a9424c52a6694af6cda3a714672550008f61d8069f6f2d6cb4ba9f57fe166e3c2c81da3d2f0d19b1e9cd
7
- data.tar.gz: 9a92452ad54043607ae87d3a947f60f1b90e782bb330e4e897d1adbf8819b4c9eafd711836aad7db0b67580894b58948e3b53232ee236b3c9833057a9ee801d0
6
+ metadata.gz: 43b8be6936526716670d5e7a582a5df17d2f8e134ed4e08a025a9f6f72dfba7f99d57e8d285a5b0f0b73249912e89a070443f8bf8eb7496e8fc916ee8724dceb
7
+ data.tar.gz: 5ffede6ccc47a50fea75f09b013e9df22e93d97c080cb6b0a85af9d63f3063b924b8e3e11a61cafb3b091fad251b0aaefef4552a13c36cb3d989ab4ef8c59235
@@ -35,8 +35,16 @@ module BahaiDate
35
35
  "#{@weekday} #{@day.number} #{@month} #{@year.bahai_era} B.E."
36
36
  end
37
37
 
38
- def next_day!
39
- initialize(date: @gregorian_date + 1)
38
+ def short_format
39
+ "#{@day.number} #{@month} #{@year.bahai_era}"
40
+ end
41
+
42
+ def +(val)
43
+ self.class.new(date: @gregorian_date + val)
44
+ end
45
+
46
+ def -(val)
47
+ self.class.new(date: @gregorian_date - val)
40
48
  end
41
49
 
42
50
  private
@@ -1,3 +1,3 @@
1
1
  module BahaiDate
2
- VERSION = '1.3.1'
2
+ VERSION = '1.4.0'
3
3
  end
@@ -11,7 +11,7 @@ module BahaiDate
11
11
  date = BahaiDate.new(year: @bahai_era, month: 1, day: 1)
12
12
  while date.year.bahai_era == @bahai_era
13
13
  add_to_calendar date
14
- date.next_day!
14
+ date += 1
15
15
  end
16
16
  end
17
17
 
@@ -230,6 +230,11 @@ module BahaiDate
230
230
  expect(bahai_date.long_format).to eq 'Istijlal 1 Baha 1 B.E.'
231
231
  end
232
232
 
233
+ it 'can provide the date in short format' do
234
+ bahai_date = BahaiDate.new(date: Date.new(1844, 3, 21))
235
+ expect(bahai_date.short_format).to eq '1 Baha 1'
236
+ end
237
+
233
238
  it 'can provide an array of occasions for a given day' do
234
239
  bahai_date = BahaiDate.new(date: Date.new(1844, 3, 21))
235
240
  occasions_array = bahai_date.occasions
@@ -238,10 +243,16 @@ module BahaiDate
238
243
  expect(occasions_array.last.short_title).to eq 'Feast of Baha'
239
244
  end
240
245
 
241
- it 'can advance to the next day' do
246
+ it 'can add to date, returning itself' do
242
247
  bahai_date = BahaiDate.new(date: Date.new(1844, 3, 21))
243
- bahai_date.next_day!
248
+ bahai_date += 1
244
249
  expect(bahai_date.gregorian_date).to eq Date.new(1844, 3, 22)
245
250
  end
251
+
252
+ it 'can subtract from the date, returning itself' do
253
+ bahai_date = BahaiDate.new(date: Date.new(1844, 3, 22))
254
+ bahai_date -= 1
255
+ expect(bahai_date.gregorian_date).to eq Date.new(1844, 3, 21)
256
+ end
246
257
  end
247
258
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bahai_date
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lessan Vaezi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-17 00:00:00.000000000 Z
11
+ date: 2015-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tzinfo
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '1.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '1.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: RubySunrise
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '0.3'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '0.3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: astro-algo
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -131,18 +131,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  version: '0'
132
132
  requirements: []
133
133
  rubyforge_project:
134
- rubygems_version: 2.2.2
134
+ rubygems_version: 2.4.8
135
135
  signing_key:
136
136
  specification_version: 4
137
137
  summary: Conversion between Gregorian and Baha'i (or Badi) calendars
138
138
  test_files:
139
- - spec/spec_helper.rb
140
- - spec/bahai_date/bahai_date_spec.rb
141
- - spec/bahai_date/logic_spec.rb
142
- - spec/bahai_date/occasion_factory_spec.rb
143
- - spec/bahai_date/year_calendar_spec.rb
144
- - spec/bahai_date/year_spec.rb
145
139
  - spec/bahai_date/occasion_spec.rb
140
+ - spec/bahai_date/day_spec.rb
141
+ - spec/bahai_date/year_spec.rb
142
+ - spec/bahai_date/occasion_factory_spec.rb
143
+ - spec/bahai_date/logic_spec.rb
146
144
  - spec/bahai_date/weekday_spec.rb
145
+ - spec/bahai_date/year_calendar_spec.rb
146
+ - spec/bahai_date/bahai_date_spec.rb
147
147
  - spec/bahai_date/month_spec.rb
148
- - spec/bahai_date/day_spec.rb
148
+ - spec/spec_helper.rb