time_compact 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d5ff3b49e76f5f5f8bab5b1a39e8f9457f40c2ac
4
- data.tar.gz: 81354900d683ff893b1dfeda26be58759bad84b7
3
+ metadata.gz: c7154fa79a650c2616e1e12e290397e0fdb208ee
4
+ data.tar.gz: 6b0edc90a8bac84512dfc4f4917f497392b21e19
5
5
  SHA512:
6
- metadata.gz: 063cde29e7c99e97c8e05b8e7384fe3e3136df71de29a90aae9b2f9a23891c7d44829a15b197f06d3c0e04a2285e13f9c5ca0f82116c612583061204014a8579
7
- data.tar.gz: 2c74e28c8b3d2de8e9c06a7a1bb5ddf928660683f027db97639a172282e98546c77f1f586f2311add5614f0a1005d934968151946b48a56cc44a285905362f5f
6
+ metadata.gz: bc5126f0138f864bcd32f11d8fd18c74823b3c8c4a5508ba8c7ecb4767fa2161b17844eeeb0a86d592b3e4e09cefd1cd433c9e1d7437a00e42bfc668f3f4fecb
7
+ data.tar.gz: 3aa51864ac2f9f632c6953dfade2f545755ddd045fb9b9a31e1f05ad9b27f385a6a99d9797a6119f7765308a5535444b32b389265e2c5aef20c0258930afa21f
data/README.md CHANGED
@@ -1,6 +1,18 @@
1
1
  # TimeCompact
2
2
 
3
- TODO: Write a gem description
3
+ Displays time compactly.
4
+
5
+ for example:
6
+
7
+ # default locale
8
+ 2014/1/2 # when other year.
9
+ 1/2 # when same year.
10
+ 8:16 # when same day.
11
+
12
+ # 日本語ロケール
13
+ 2014年1月2日 # 違う年の時
14
+ 1月2日 # 同じ年の時
15
+ 8時16分 # 同じ日の時
4
16
 
5
17
  ## Installation
6
18
 
@@ -18,11 +30,29 @@ Or install it yourself as:
18
30
 
19
31
  ## Usage
20
32
 
21
- TODO: Write usage instructions here
33
+ require 'time_compact'
34
+
35
+ include TimeCompact
36
+ time_compact Time.new(2014, 1, 1, 0, 0, 0) # => 5/2
37
+
38
+ In rails
39
+
40
+ <%= time_compact @post.created_at %>
41
+
42
+ You can customize the format.
43
+
44
+ # config/locales/en.yml:
45
+ en:
46
+ time_compact:
47
+ same_year: '%{month}/%{day}'
48
+ same_month: '%{month}/%{day}'
49
+ same_day: '%{hour}:%{min}'
50
+ same_hour: '%{min} min'
51
+ other: '%{year}/%{month}/%{day}'
22
52
 
23
53
  ## Contributing
24
54
 
25
- 1. Fork it ( https://github.com/[my-github-username]/time_compact/fork )
55
+ 1. Fork it ( https://github.com/komagata/time_compact/fork )
26
56
  2. Create your feature branch (`git checkout -b my-new-feature`)
27
57
  3. Commit your changes (`git commit -am 'Add some feature'`)
28
58
  4. Push to the branch (`git push origin my-new-feature`)
@@ -1,3 +1,3 @@
1
1
  module TimeCompact
2
- VERSION = '0.0.1'
2
+ VERSION = '0.1.0'
3
3
  end
data/lib/time_compact.rb CHANGED
@@ -26,7 +26,7 @@ module TimeCompact
26
26
  month: time.month,
27
27
  day: time.day,
28
28
  hour: time.hour,
29
- min: time.min
29
+ min: '%02d' % time.min
30
30
  )
31
31
  end
32
32
  else
@@ -36,7 +36,7 @@ module TimeCompact
36
36
  month: time.month,
37
37
  day: time.day,
38
38
  hour: time.hour,
39
- min: time.min
39
+ min: '%02d' % time.min
40
40
  )
41
41
  end
42
42
  else
@@ -46,7 +46,7 @@ module TimeCompact
46
46
  month: time.month,
47
47
  day: time.day,
48
48
  hour: time.hour,
49
- min: time.min
49
+ min: '%02d' % time.min
50
50
  )
51
51
  end
52
52
  else
@@ -56,7 +56,7 @@ module TimeCompact
56
56
  month: time.month,
57
57
  day: time.day,
58
58
  hour: time.hour,
59
- min: time.min
59
+ min: '%02d' % time.min
60
60
  )
61
61
  end
62
62
  end
@@ -22,7 +22,7 @@ class TestTimeCompact < MiniTest::Unit::TestCase
22
22
  Time.new(2014, 1, 1, 0, 0, 0),
23
23
  Time.new(2014, 1, 2, 0, 0, 0)
24
24
  )
25
- assert_equal '0:0', @object.time_compact(
25
+ assert_equal '0:00', @object.time_compact(
26
26
  Time.new(2014, 1, 1, 0, 0, 0),
27
27
  Time.new(2014, 1, 1, 1, 0, 0)
28
28
  )
@@ -46,7 +46,7 @@ class TestTimeCompact < MiniTest::Unit::TestCase
46
46
  Time.new(2014, 1, 1, 0, 0, 0),
47
47
  Time.new(2014, 1, 2, 0, 0, 0)
48
48
  )
49
- assert_equal '0時0分', @object.time_compact(
49
+ assert_equal '0時00分', @object.time_compact(
50
50
  Time.new(2014, 1, 1, 0, 0, 0),
51
51
  Time.new(2014, 1, 1, 1, 0, 0)
52
52
  )
data/time_compact.gemspec CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.version = TimeCompact::VERSION
9
9
  spec.authors = ["Masaki Komagata"]
10
10
  spec.email = ["komagata@gmail.com"]
11
- spec.summary = %q{Show time shortly.}
12
- spec.description = %q{Show time for compact style.}
11
+ spec.summary = %q{Displays time compactly.}
12
+ spec.description = %q{Displays time compactly.}
13
13
  spec.homepage = "https://github.com/komagata/time_compact"
14
14
  spec.license = "MIT"
15
15
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: time_compact
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masaki Komagata
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-02 00:00:00.000000000 Z
11
+ date: 2014-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -52,7 +52,7 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- description: Show time for compact style.
55
+ description: Displays time compactly.
56
56
  email:
57
57
  - komagata@gmail.com
58
58
  executables: []
@@ -94,6 +94,7 @@ rubyforge_project:
94
94
  rubygems_version: 2.2.2
95
95
  signing_key:
96
96
  specification_version: 4
97
- summary: Show time shortly.
97
+ summary: Displays time compactly.
98
98
  test_files:
99
99
  - test/test_time_compact.rb
100
+ has_rdoc: