tokiyomi 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ece9455957384d0c7355d4fae09c84a2f28e118a
4
+ data.tar.gz: ee54e8bc0cf03d55ad953c63dfb613e9d338bf54
5
+ SHA512:
6
+ metadata.gz: 9c195dbf208bd89513600336f3259addad4b1eb4b2c0a04947d09b20055b8e965510f3ae2c334419e74098a5269e1b4f2e83f932020ca85e54e43847e096f616
7
+ data.tar.gz: f7e2c8a60da63373734192033aca50a83c4a3b14c0a011ad80ebb7e29b06d436306be9bab56906a91c57c6bcf5c9d578aa881deede0e587cc74128c670f9b9ba
data/README.md CHANGED
@@ -36,7 +36,7 @@ Tokiyomi.parse('3時間後') # => 2013-01-10T15:34:56
36
36
 
37
37
  ```
38
38
  Tokiyomi.parse('2ヵ月前の20:00') # => 2012-11-10T20:00:00
39
- Tokiyomi.parse('1週間後の0:00') # => 2013-01-17T00:00:00
39
+ Tokiyomi.parse('1週間後の00:00') # => 2013-01-17T00:00:00
40
40
  ```
41
41
 
42
42
  * 今日, 明日, 明後日, 昨日, 一昨日
@@ -7,6 +7,7 @@ module Tokiyomi
7
7
  '年' => :years,
8
8
  '月' => :months,
9
9
  '日' => :days,
10
+ '週間' => :weeks,
10
11
  '時間' => :hours,
11
12
  '分' => :minutes,
12
13
  '秒' => :seconds,
@@ -38,7 +39,7 @@ module Tokiyomi
38
39
  private
39
40
 
40
41
  def hour_min_fixable?
41
- hour_min && unit.in?([:years, :months, :days])
42
+ hour_min && unit.in?([:years, :months, :weeks, :days])
42
43
  end
43
44
  end
44
45
  end
@@ -21,7 +21,7 @@ module Tokiyomi
21
21
  end
22
22
 
23
23
  def calculate(base)
24
- duration.send(unit).send(direction, base)
24
+ duration.__send__(unit).__send__(direction, base)
25
25
  end
26
26
  end
27
27
  end
@@ -1,3 +1,3 @@
1
1
  module Tokiyomi
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -10,7 +10,7 @@ end
10
10
 
11
11
  RSpec::Matchers.define :be_calculated_to do |expect|
12
12
  match do |relative_time|
13
- relative_time.calculate(now).should == Time.parse(expect)
13
+ expect(relative_time.calculate(now)).to eq(Time.parse(expect))
14
14
  end
15
15
  end
16
16
  require 'time'
@@ -11,8 +11,10 @@ describe Tokiyomi::RelativeTime do
11
11
 
12
12
  specify { expect(rel_time('3日前')).to be_calculated_to('2013/01/07 12:34:56') }
13
13
  specify { expect(rel_time('10分後')).to be_calculated_to('2013/01/10 12:44:56') }
14
+ specify { expect(rel_time('1週間前')).to be_calculated_to('2013/01/03 12:34:56') }
14
15
 
15
16
  specify { expect(rel_time('2日後の20:00')).to be_calculated_to('2013/01/12 20:00:00') }
17
+ specify { expect(rel_time('1週間後の00:00')).to be_calculated_to('2013/01/17 00:00:00') }
16
18
 
17
19
  specify { expect { rel_time('いつか').to raise_error(ArgumentError) } }
18
20
  specify { expect { rel_time('1日後の10:').to raise_error(ArgumentError) } }
@@ -2,12 +2,12 @@
2
2
  require 'tokiyomi'
3
3
 
4
4
  describe Tokiyomi do
5
- specify { Tokiyomi.parse('10日前').should be_kind_of(Time) }
5
+ specify { expect(Tokiyomi.parse('10日前')).to be_kind_of(Time) }
6
6
 
7
7
  describe '.readable?' do
8
- specify { Tokiyomi.readable?('10日前').should be_true }
9
- specify { Tokiyomi.readable?('日後').should be_false }
10
- specify { Tokiyomi.readable?('おっととい').should be_false }
11
- specify { Tokiyomi.readable?('おととい').should be_true }
8
+ specify { expect(Tokiyomi.readable?('10日前')).to be_truthy }
9
+ specify { expect(Tokiyomi.readable?('日後')).to be_falsey }
10
+ specify { expect(Tokiyomi.readable?('おっととい')).to be_falsey }
11
+ specify { expect(Tokiyomi.readable?('おととい')).to be_truthy }
12
12
  end
13
13
  end
metadata CHANGED
@@ -1,62 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tokiyomi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
5
- prerelease:
4
+ version: 0.1.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - moro
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-01-10 00:00:00.000000000 Z
11
+ date: 2014-12-24 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: activesupport
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rspec
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  description: Japanese relative date/time string parser.
@@ -66,7 +59,7 @@ executables: []
66
59
  extensions: []
67
60
  extra_rdoc_files: []
68
61
  files:
69
- - .gitignore
62
+ - ".gitignore"
70
63
  - Gemfile
71
64
  - LICENSE.txt
72
65
  - README.md
@@ -83,27 +76,26 @@ files:
83
76
  - tokiyomi.gemspec
84
77
  homepage: ''
85
78
  licenses: []
79
+ metadata: {}
86
80
  post_install_message:
87
81
  rdoc_options: []
88
82
  require_paths:
89
83
  - lib
90
84
  required_ruby_version: !ruby/object:Gem::Requirement
91
- none: false
92
85
  requirements:
93
- - - ! '>='
86
+ - - ">="
94
87
  - !ruby/object:Gem::Version
95
88
  version: '0'
96
89
  required_rubygems_version: !ruby/object:Gem::Requirement
97
- none: false
98
90
  requirements:
99
- - - ! '>='
91
+ - - ">="
100
92
  - !ruby/object:Gem::Version
101
93
  version: '0'
102
94
  requirements: []
103
95
  rubyforge_project:
104
- rubygems_version: 1.8.23
96
+ rubygems_version: 2.2.2
105
97
  signing_key:
106
- specification_version: 3
98
+ specification_version: 4
107
99
  summary: Japanese relative date/time string parser.
108
100
  test_files:
109
101
  - spec/spec_helper.rb