aka_time 1.0.3 → 1.0.4
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.
- data/Rakefile +1 -2
- data/lib/aka_time.rb +1 -1
- data/lib/aka_time/version.rb +1 -1
- data/test/aka_time_test.rb +1 -1
- metadata +1 -3
- data/spec/aka_time_spec.rb +0 -233
- data/spec/coba.rb +0 -12
data/Rakefile
CHANGED
@@ -17,7 +17,7 @@ RUBY_FORGE_PROJECT = "aka_time"
|
|
17
17
|
RUBY_FORGE_USER = "ariekusuma"
|
18
18
|
|
19
19
|
PKG_FILES = FileList[
|
20
|
-
"Rakefile", "
|
20
|
+
"Rakefile", "test/*", "lib/*", "lib/**/*", "resources/*"
|
21
21
|
].exclude("rdoc").to_a
|
22
22
|
|
23
23
|
# Generate the RDoc documentation
|
@@ -58,7 +58,6 @@ spec = Gem::Specification.new do |s|
|
|
58
58
|
s.require_path = "lib"
|
59
59
|
s.autorequire = "aka_time.rb"
|
60
60
|
s.test_file = "test/aka_time_test.rb"
|
61
|
-
# s.spec_file = "spec/aka_time_spec.rb"
|
62
61
|
s.has_rdoc = true
|
63
62
|
s.extra_rdoc_files = ["AUTHORS", "CHANGES", "MIT-LICENSE", "README", "TODO"]
|
64
63
|
s.rdoc_options += [
|
data/lib/aka_time.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# Copyright (c) 2007 ArieKeren <ariekusumaatmaja@gmail.com>
|
3
3
|
# http://ariekusumaatmaja.wordpress.com
|
4
4
|
#
|
5
|
-
# $URL: svn+ssh://ariekusuma@rubyforge.org/var/svn/aka/aka_time/tags/
|
5
|
+
# $URL: svn+ssh://ariekusuma@rubyforge.org/var/svn/aka/aka_time/tags/REL_1_0_4/lib/aka_time.rb $
|
6
6
|
# $Author: ariekusuma $
|
7
7
|
# $Date: 2007-08-29 00:35:51 +0700 (Wed, 29 Aug 2007) $
|
8
8
|
# $Rev: 29 $
|
data/lib/aka_time/version.rb
CHANGED
data/test/aka_time_test.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# Copyright (c) 2007 ArieKeren <ariekusumaatmaja@gmail.com>
|
3
3
|
# http://ariekusumaatmaja.wordpress.com
|
4
4
|
#
|
5
|
-
# $URL: svn+ssh://ariekusuma@rubyforge.org/var/svn/aka/aka_time/tags/
|
5
|
+
# $URL: svn+ssh://ariekusuma@rubyforge.org/var/svn/aka/aka_time/tags/REL_1_0_4/test/aka_time_test.rb $
|
6
6
|
# $Author: ariekusuma $
|
7
7
|
# $Date: 2007-04-17 14:04:03 +0700 (Tue, 17 Apr 2007) $
|
8
8
|
# $Rev: 18 $
|
metadata
CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: aka_time
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.0.
|
6
|
+
version: 1.0.4
|
7
7
|
date: 2007-08-29 00:00:00 +07:00
|
8
8
|
summary: AkaTime / aka_time / ArieKeren Time adalah Library Ruby Time Format Indonesia yang intuitif. AkaTime is an intuitive Indonesian Time Format.
|
9
9
|
require_paths:
|
@@ -30,8 +30,6 @@ authors:
|
|
30
30
|
- Arie Kusuma Atmaja
|
31
31
|
files:
|
32
32
|
- Rakefile
|
33
|
-
- spec/aka_time_spec.rb
|
34
|
-
- spec/coba.rb
|
35
33
|
- test/aka_time_test.rb
|
36
34
|
- lib/aka_time
|
37
35
|
- lib/aka_time.rb
|
data/spec/aka_time_spec.rb
DELETED
@@ -1,233 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
# Copyright (c) 2007 ArieKeren <ariekusumaatmaja@gmail.com>
|
3
|
-
# http://ariekusumaatmaja.wordpress.com
|
4
|
-
#
|
5
|
-
# $URL: svn+ssh://ariekusuma@rubyforge.org/var/svn/aka/aka_time/tags/REL_1_0_3/spec/aka_time_spec.rb $
|
6
|
-
# $Author: ariekusuma $
|
7
|
-
# $Date: 2007-08-29 00:32:39 +0700 (Wed, 29 Aug 2007) $
|
8
|
-
# $Rev: 28 $
|
9
|
-
#++
|
10
|
-
|
11
|
-
# cara pakainya masuk ke dalam direktori spec dulu, jangan lupa!
|
12
|
-
# kalau dari main direktori pasti require dibawah ini gak jalan..
|
13
|
-
require "../lib/aka_time.rb"
|
14
|
-
|
15
|
-
describe "Time" do
|
16
|
-
|
17
|
-
before :each do
|
18
|
-
@time = Time.mktime(1981, 12, 18, 2, 43, 51)
|
19
|
-
end
|
20
|
-
|
21
|
-
=begin rdoc
|
22
|
-
detik aka_time return sec, detik
|
23
|
-
aka_time bisa return 2 jenis, yaitu:
|
24
|
-
1. Fixnum, ini supaya bisa dikombinasikan dengan aka_angka,
|
25
|
-
(tentu setelah instal dulu rubygem tsb).
|
26
|
-
Mis. tiga puluh detik lagi.
|
27
|
-
2. String, ini mengikuti default, selain juga karena alasan
|
28
|
-
walau berbentuk angka tapi tidak untuk dihitung
|
29
|
-
=end
|
30
|
-
it "should return second" do
|
31
|
-
@time.sec.should == 51
|
32
|
-
@time.detik.should == "51"
|
33
|
-
end
|
34
|
-
|
35
|
-
it "should return second (sec) as an instance of Fixnum" do
|
36
|
-
@time.sec.should be_an_instance_of(Fixnum)
|
37
|
-
end
|
38
|
-
|
39
|
-
it "should return second (detik) as an instance of String" do
|
40
|
-
@time.detik.should be_an_instance_of(String)
|
41
|
-
end
|
42
|
-
|
43
|
-
# detik bawaan ruby return string
|
44
|
-
it "should return Time.strftime(\"%S\")" do
|
45
|
-
@time.strftime("%S").should == "51"
|
46
|
-
end
|
47
|
-
|
48
|
-
it "should return Time.strftime(\"%S\") as an instance of String" do
|
49
|
-
@time.strftime("%S").should be_an_instance_of(String)
|
50
|
-
end
|
51
|
-
|
52
|
-
# menit aka_time, min, menit return Fixnum, String
|
53
|
-
it "should return minute" do
|
54
|
-
@time.min.should == 43
|
55
|
-
@time.menit.should == "43"
|
56
|
-
end
|
57
|
-
|
58
|
-
it "should return minute (min) as an instance of Fixnum" do
|
59
|
-
@time.min.should be_an_instance_of(Fixnum)
|
60
|
-
end
|
61
|
-
|
62
|
-
it "should return minute (menit) as an instance of String" do
|
63
|
-
@time.menit.should be_an_instance_of(String)
|
64
|
-
end
|
65
|
-
|
66
|
-
# menit bawaan ruby return string
|
67
|
-
it "should return Time.strftime(\"%M\")" do
|
68
|
-
@time.strftime("%M").should == "43"
|
69
|
-
end
|
70
|
-
|
71
|
-
it "should return Time.strftime(\"%M\") as an instance of String" do
|
72
|
-
@time.strftime("%M").should be_an_instance_of(String)
|
73
|
-
end
|
74
|
-
|
75
|
-
# jam aka_time, hour, jam return Fixnum, String
|
76
|
-
it "should return hour" do
|
77
|
-
@time.hour.should == 2
|
78
|
-
@time.jam.should == "02"
|
79
|
-
end
|
80
|
-
|
81
|
-
it "should return hour (hour) as an instance of Fixnum" do
|
82
|
-
@time.hour.should be_an_instance_of(Fixnum)
|
83
|
-
end
|
84
|
-
|
85
|
-
it "should return hour (jam) as an instance of String" do
|
86
|
-
@time.jam.should be_an_instance_of(String)
|
87
|
-
end
|
88
|
-
|
89
|
-
# jam bawaan ruby return string
|
90
|
-
it "should return Time.strftime(\"%H\") as an instance of String" do
|
91
|
-
@time.strftime("%H").should be_an_instance_of(String)
|
92
|
-
end
|
93
|
-
|
94
|
-
# year 4 digit aka_time, year, tahun return Fixnum, String
|
95
|
-
it "should return year 4 digit" do
|
96
|
-
@time.year.should == 1981
|
97
|
-
@time.tahun.should == "1981"
|
98
|
-
end
|
99
|
-
|
100
|
-
it "should return year 2 digit" do
|
101
|
-
@time.thn.should == "81"
|
102
|
-
end
|
103
|
-
|
104
|
-
it "should return year 4 digit (year) as an instance of Fixnum" do
|
105
|
-
@time.year.should be_an_instance_of(Fixnum)
|
106
|
-
end
|
107
|
-
|
108
|
-
it "should return year 4 digit (tahun) as an instance of String" do
|
109
|
-
@time.tahun.should be_an_instance_of(String)
|
110
|
-
end
|
111
|
-
|
112
|
-
it "should return year 2 digit (thn) as an instance of String" do
|
113
|
-
@time.thn.should be_an_instance_of(String)
|
114
|
-
end
|
115
|
-
|
116
|
-
# year bawaan ruby return string
|
117
|
-
it "should return Time.strftime(\"%Y\") as an instance of String with size 4" do
|
118
|
-
@time.strftime("%Y").should be_an_instance_of(String)
|
119
|
-
@time.strftime("%Y").size.should == 4
|
120
|
-
end
|
121
|
-
|
122
|
-
it "should return Time.strftime(\"%y\") as an instance of String with size 2" do
|
123
|
-
@time.strftime("%y").should be_an_instance_of(String)
|
124
|
-
@time.strftime("%y").size.should == 2
|
125
|
-
end
|
126
|
-
|
127
|
-
# bulan aka_time, bulan, bln return string dua-duanya. (bln itu singkatannya)
|
128
|
-
it "should return month" do
|
129
|
-
@time.bulan.should == "Desember"
|
130
|
-
@time.bln.should == "Des"
|
131
|
-
end
|
132
|
-
|
133
|
-
it "should return month as an instance of String" do
|
134
|
-
@time.bulan.should be_an_instance_of(String)
|
135
|
-
@time.bln.should be_an_instance_of(String)
|
136
|
-
end
|
137
|
-
|
138
|
-
# bulan bawaan ruby return string juga (satu saja)
|
139
|
-
it "should return Time.strftime(\"%B\") as an instance of String" do
|
140
|
-
@time.strftime("%B").should be_an_instance_of(String)
|
141
|
-
end
|
142
|
-
|
143
|
-
it "should return Time.bln as an instance of String with size 3" do
|
144
|
-
@time.bln.should be_an_instance_of(String)
|
145
|
-
@time.bln.size == 3
|
146
|
-
end
|
147
|
-
|
148
|
-
# tanggal aka_time return string (tgl itu singkatannya)
|
149
|
-
it "should return tanggal" do
|
150
|
-
@time.tanggal.should == "18"
|
151
|
-
@time.tgl.should == "18"
|
152
|
-
end
|
153
|
-
|
154
|
-
it "should return tanggal as an instance of String" do
|
155
|
-
@time.tanggal.should be_an_instance_of(String)
|
156
|
-
@time.tgl.should be_an_instance_of(String)
|
157
|
-
end
|
158
|
-
|
159
|
-
# kalau mau tanggal yang instance Fixnum, pakai metode day
|
160
|
-
it "should return tanggal (day) as integer" do
|
161
|
-
@time.day.should == 18
|
162
|
-
end
|
163
|
-
|
164
|
-
it "should return tanggal (day) as an instance of Fixnum" do
|
165
|
-
@time.day.should be_an_instance_of(Fixnum)
|
166
|
-
end
|
167
|
-
|
168
|
-
# tanggal bawaan ruby, selain metode day, bisa pakai strftime("%d")
|
169
|
-
it "should return Time.strftime(\"%d\")" do
|
170
|
-
@time.strftime("%d").should == "18"
|
171
|
-
end
|
172
|
-
|
173
|
-
it "should return Time.strftime(\"%d\") as an instance of String" do
|
174
|
-
@time.strftime("%d").should be_an_instance_of(String)
|
175
|
-
end
|
176
|
-
|
177
|
-
# hari aka_time return string (hr itu singkatannya)
|
178
|
-
it "should return hari" do
|
179
|
-
@time.hari.should == "Jumat"
|
180
|
-
@time.hr.should == "Jum"
|
181
|
-
end
|
182
|
-
|
183
|
-
# bawaan ruby pakai Time.strftime("%A") (tapi bahasa Inggris)
|
184
|
-
it "should return hari in English" do
|
185
|
-
@time.strftime("%A").should == "Friday"
|
186
|
-
end
|
187
|
-
|
188
|
-
it "should return jam_menit_detik" do
|
189
|
-
@time.jam_menit_detik.should == "02:43:51"
|
190
|
-
@time.strftime("%X").should == "02:43:51"
|
191
|
-
end
|
192
|
-
|
193
|
-
# tanggalnya yang disingkat-singkat
|
194
|
-
it "should return tanggal_bulan_tahun" do
|
195
|
-
@time.tanggal_bulan_tahun.should == "18 Desember 1981"
|
196
|
-
@time.tgl_bulan_tahun.should == "18 Desember 1981"
|
197
|
-
end
|
198
|
-
|
199
|
-
# bulannya yang disingkat-singkat
|
200
|
-
it "should return tanggal_bln_tahun" do
|
201
|
-
@time.tanggal_bln_tahun.should == "18 Des 1981"
|
202
|
-
@time.tgl_bln_tahun.should == "18 Des 1981"
|
203
|
-
end
|
204
|
-
|
205
|
-
# tahunnya yang disingkat-singkat
|
206
|
-
it "should return tanggal_bln_thn" do
|
207
|
-
@time.tanggal_bln_thn.should == "18 Des 81"
|
208
|
-
@time.tgl_bln_thn.should == "18 Des 81"
|
209
|
-
end
|
210
|
-
|
211
|
-
it "should return tanggal_bulan_thn" do
|
212
|
-
@time.tanggal_bulan_thn.should == "18 Desember 81"
|
213
|
-
@time.tgl_bulan_thn.should == "18 Desember 81"
|
214
|
-
end
|
215
|
-
|
216
|
-
# perhatikan expected_result nya sajalah, susah aku cakap bahasa indonesianya :-P
|
217
|
-
it "should return indo" do
|
218
|
-
expected_result = "Jumat, 18 Desember 1981 02:43:51"
|
219
|
-
@time.indo.should == expected_result
|
220
|
-
@time.tanggalan_waktu.should == expected_result
|
221
|
-
@time.to_tanggalan_waktu.should == expected_result
|
222
|
-
@time.id.should == expected_result
|
223
|
-
@time.to_id.should == expected_result
|
224
|
-
@time.indonesia.should == expected_result
|
225
|
-
@time.to_id.should == expected_result
|
226
|
-
end
|
227
|
-
|
228
|
-
# ini idenya dari Time.strftime("%x") tinggal dibalik aja kalau versi Indonesianya
|
229
|
-
it "should return x" do
|
230
|
-
@time.x.should == "18/12/81"
|
231
|
-
end
|
232
|
-
|
233
|
-
end
|
data/spec/coba.rb
DELETED