ethiopic_date 0.0.9 → 0.0.10

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5937169fe53913c5347835b9239988d117f0a211
4
+ data.tar.gz: 9a5afaaea202ad8fdcd25895676ed7a40958e87b
5
+ SHA512:
6
+ metadata.gz: 1fb83708eddd0f1ef802ee1e54d764401655be3e0cd2786b8b06dad7be0cb30446b0a65b65fc2852f596adc29e0fe0e6d47c92ac106c53079f105111fc67e640
7
+ data.tar.gz: 1f39f2c21df660620b5ba225e4cd858dfe50f807bba52d0d8cfb7041aced2ab27524dcea0462739c27ffd1b39c5772b29d35ad76d7c607cf12a9f8d5b73594c4
@@ -1,3 +1,3 @@
1
1
  module EthiopicDate
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
data/lib/ethiopic_date.rb CHANGED
@@ -9,6 +9,9 @@ module EthiopicDate
9
9
  public
10
10
  Nmonths = 12
11
11
  MonthDays = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
12
+ AmharicMonths = {:1=>'መስከረም',:2=>'ጥቅምት',:3=>'ህዳር',:4=>'ታህሳስ',:5=>'ጥር',:6=>'የካቲት',
13
+ :7=>'መጋቢት',:8=>'ሚያዝያ',:9=>'ግንቦት',:10=>'ሰኔ',:11=>'ሐምሌ',:12=>'ነሃሴ',:13=>'ጳጉሜ'}
14
+ AmharicDays = {:Sunday=>'እሁድ',:Monday=>'ሰኞ',:Tuesday=>'ማክሰኞ',:Wednesday=>'ሮብ',:Thursday=>'ሓሙስ',:Friday=>'ኣርብ',:Saturday=>'ቅዳሜ'}
12
15
 
13
16
  #Ethiopic: Julian date offset
14
17
  JD_EPOCH_OFFSET_AMETE_MIHRET = 1723856 # ዓ/ም
@@ -27,11 +30,11 @@ module EthiopicDate
27
30
  #@return GregorianDate is returned
28
31
  #@example fromEthiopicToGregorian(2004,5,21)
29
32
 
30
- def fromEthiopicToGregorian(ethiopic_date)
33
+ def fromEthiopicToGregorian(year,month,day)
31
34
  #TODO : Handle Exceptions when there is a wrong input
32
- year=ethiopic_date[:year]
33
- month=ethiopic_date[:month]
34
- day=ethiopic_date[:day]
35
+ year=year
36
+ month=month
37
+ day=day
35
38
  if (year <=0)
36
39
  era=JD_EPOCH_OFFSET_AMETE_ALEM
37
40
  else
@@ -47,12 +50,14 @@ module EthiopicDate
47
50
  #@param year,month, day in that order
48
51
  #@return EthiopicDate is returned
49
52
  #@example fromEthiopicToGregorian(2012,5,21)
50
- def fromGregorianToEthiopic(gregorian_date)
53
+ def fromGregorianToEthiopic(year,month,day)
51
54
  #TODO : Handle Exceptions when there is a wrong input
52
- year=gregorian_date.year
53
- month=gregorian_date.month
54
- day=gregorian_date.day
55
- ethiopic_date = {:year=>-1,:month=>-1,:day => -1 }
55
+ year=year
56
+ month=month
57
+ day=day
58
+ date = Date.new.(year,month,day)
59
+ dayName = date.strftime('%A')
60
+ ethiopic_date = {:year=>-1,:month=>-1,:day => -1,:dayName=> dayName }
56
61
  jdn = jdn_from_gregorian(year,month,day)
57
62
  if jdn >=JD_EPOCH_OFFSET_AMETE_MIHRET + 365
58
63
  era= JD_EPOCH_OFFSET_AMETE_MIHRET
@@ -65,7 +70,7 @@ module EthiopicDate
65
70
  ethiopic_date[:month] =(n/30) + 1
66
71
  ethiopic_date[:day] =(n.modulo(30)) + 1
67
72
 
68
- return ethiopic_date_format(ethiopic_date)
73
+ return ethiopic_date
69
74
  end
70
75
 
71
76
 
@@ -78,22 +83,7 @@ module EthiopicDate
78
83
  year=ethiopic_date[:year]
79
84
  month=ethiopic_date[:month]
80
85
  day=ethiopic_date[:day]
81
- case month
82
- when 1 then month_name="መስከረም "
83
- when 2 then month_name="ጥቅምት "
84
- when 3 then month_name="ህዳር "
85
- when 4 then month_name="ታህሳስ "
86
- when 5 then month_name="ጥር "
87
- when 6 then month_name="የካቲት "
88
- when 7 then month_name="መጋቢት "
89
- when 8 then month_name="ሚያዝያ "
90
- when 9 then month_name="ግንቦት "
91
- when 10 then month_name="ሰኔ "
92
- when 11 then month_name="ሐምሌ "
93
- when 12 then month_name="ነሃሴ "
94
- when 13 then month_name="ጳጉሜን "
95
- end
96
- return " #{month_name} #{day} ቀን #{year}ዓ/ም "
86
+ return " #{AmharicDays[:ethiopic_date[:dayName]]}, #{day} #{AmharicMonths[:month]} #{year} "
97
87
  end
98
88
 
99
89
  private
metadata CHANGED
@@ -1,28 +1,22 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: ethiopic_date
3
- version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.0.9
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.10
6
5
  platform: ruby
7
- authors:
6
+ authors:
8
7
  - G/yohannes Zenebe
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
-
13
- date: 2012-11-22 00:00:00 Z
11
+ date: 2013-09-19 00:00:00.000000000 Z
14
12
  dependencies: []
15
-
16
13
  description: Simple gem to convert between Ethiopian and Gregorian dates
17
- email:
14
+ email:
18
15
  - gebreyohannes@gemhalo.org
19
16
  executables: []
20
-
21
17
  extensions: []
22
-
23
18
  extra_rdoc_files: []
24
-
25
- files:
19
+ files:
26
20
  - .gitignore
27
21
  - Gemfile
28
22
  - LICENSE.txt
@@ -33,31 +27,25 @@ files:
33
27
  - lib/ethiopic_date/version.rb
34
28
  homepage: https://github.com/gyohannes/ethiopic_date
35
29
  licenses: []
36
-
30
+ metadata: {}
37
31
  post_install_message:
38
32
  rdoc_options: []
39
-
40
- require_paths:
33
+ require_paths:
41
34
  - lib
42
- required_ruby_version: !ruby/object:Gem::Requirement
43
- none: false
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: "0"
48
- required_rubygems_version: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ">="
52
- - !ruby/object:Gem::Version
53
- version: "0"
35
+ required_ruby_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ required_rubygems_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
54
45
  requirements: []
55
-
56
46
  rubyforge_project:
57
- rubygems_version: 1.8.8
47
+ rubygems_version: 2.0.3
58
48
  signing_key:
59
- specification_version: 3
49
+ specification_version: 4
60
50
  summary: Ethiopian date to Gregorian and Vice versa convertor
61
51
  test_files: []
62
-
63
- has_rdoc: