chronic-davispuh 0.10.2.v0.1da32066b3f46f2506b3471e39557497e34afa27

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.
Files changed (64) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +8 -0
  3. data/.travis.yml +10 -0
  4. data/Gemfile +3 -0
  5. data/HISTORY.md +243 -0
  6. data/LICENSE +21 -0
  7. data/README.md +185 -0
  8. data/Rakefile +68 -0
  9. data/chronic.gemspec +27 -0
  10. data/lib/chronic.rb +122 -0
  11. data/lib/chronic/arrow.rb +270 -0
  12. data/lib/chronic/date.rb +272 -0
  13. data/lib/chronic/definition.rb +208 -0
  14. data/lib/chronic/dictionary.rb +36 -0
  15. data/lib/chronic/handler.rb +44 -0
  16. data/lib/chronic/handlers/anchor.rb +65 -0
  17. data/lib/chronic/handlers/arrow.rb +84 -0
  18. data/lib/chronic/handlers/date.rb +270 -0
  19. data/lib/chronic/handlers/date_time.rb +72 -0
  20. data/lib/chronic/handlers/general.rb +130 -0
  21. data/lib/chronic/handlers/narrow.rb +54 -0
  22. data/lib/chronic/handlers/time.rb +167 -0
  23. data/lib/chronic/handlers/time_zone.rb +50 -0
  24. data/lib/chronic/objects/anchor_object.rb +263 -0
  25. data/lib/chronic/objects/arrow_object.rb +27 -0
  26. data/lib/chronic/objects/date_object.rb +164 -0
  27. data/lib/chronic/objects/date_time_object.rb +64 -0
  28. data/lib/chronic/objects/handler_object.rb +81 -0
  29. data/lib/chronic/objects/narrow_object.rb +85 -0
  30. data/lib/chronic/objects/time_object.rb +96 -0
  31. data/lib/chronic/objects/time_zone_object.rb +27 -0
  32. data/lib/chronic/parser.rb +154 -0
  33. data/lib/chronic/span.rb +32 -0
  34. data/lib/chronic/tag.rb +84 -0
  35. data/lib/chronic/tags/day_name.rb +34 -0
  36. data/lib/chronic/tags/day_portion.rb +33 -0
  37. data/lib/chronic/tags/day_special.rb +30 -0
  38. data/lib/chronic/tags/grabber.rb +29 -0
  39. data/lib/chronic/tags/keyword.rb +63 -0
  40. data/lib/chronic/tags/month_name.rb +39 -0
  41. data/lib/chronic/tags/ordinal.rb +52 -0
  42. data/lib/chronic/tags/pointer.rb +28 -0
  43. data/lib/chronic/tags/rational.rb +35 -0
  44. data/lib/chronic/tags/scalar.rb +101 -0
  45. data/lib/chronic/tags/season_name.rb +31 -0
  46. data/lib/chronic/tags/separator.rb +130 -0
  47. data/lib/chronic/tags/sign.rb +35 -0
  48. data/lib/chronic/tags/time_special.rb +34 -0
  49. data/lib/chronic/tags/time_zone.rb +56 -0
  50. data/lib/chronic/tags/unit.rb +174 -0
  51. data/lib/chronic/time.rb +141 -0
  52. data/lib/chronic/time_zone.rb +80 -0
  53. data/lib/chronic/token.rb +61 -0
  54. data/lib/chronic/token_group.rb +271 -0
  55. data/lib/chronic/tokenizer.rb +42 -0
  56. data/lib/chronic/version.rb +3 -0
  57. data/test/helper.rb +12 -0
  58. data/test/test_chronic.rb +190 -0
  59. data/test/test_daylight_savings.rb +98 -0
  60. data/test/test_handler.rb +113 -0
  61. data/test/test_parsing.rb +1520 -0
  62. data/test/test_span.rb +23 -0
  63. data/test/test_token.rb +31 -0
  64. metadata +218 -0
@@ -0,0 +1,23 @@
1
+ require 'helper'
2
+
3
+ class TestSpan < TestCase
4
+
5
+ def setup
6
+ # Wed Aug 16 14:00:00 UTC 2006
7
+ @now = Time.local(2006, 8, 16, 14, 0, 0, 0)
8
+ end
9
+
10
+ def test_span_width
11
+ span = Chronic::Span.new(Time.local(2006, 8, 16, 0), Time.local(2006, 8, 17, 0))
12
+ assert_equal((60 * 60 * 24), span.width)
13
+ end
14
+
15
+ def test_span_math
16
+ s = Chronic::Span.new(1, 2)
17
+ assert_equal 2, (s + 1).begin
18
+ assert_equal 3, (s + 1).end
19
+ assert_equal 0, (s - 1).begin
20
+ assert_equal 1, (s - 1).end
21
+ end
22
+
23
+ end
@@ -0,0 +1,31 @@
1
+ require 'helper'
2
+
3
+ class TestToken < TestCase
4
+
5
+ def setup
6
+ # Wed Aug 16 14:00:00 UTC 2006
7
+ @now = Time.local(2006, 8, 16, 14, 0, 0, 0)
8
+ end
9
+
10
+ def test_token
11
+ token = Chronic::Token.new('foo')
12
+ assert_equal 0, token.tags.size
13
+ assert !token.tagged?
14
+ token.tag("mytag")
15
+ assert_equal 1, token.tags.size
16
+ assert token.tagged?
17
+ assert_equal String, token.get_tag(String).class
18
+ token.tag(5)
19
+ assert_equal 2, token.tags.size
20
+ token.untag(String)
21
+ assert_equal 1, token.tags.size
22
+ assert_equal 'foo', token.word
23
+ end
24
+
25
+ def test_token_inspect_doesnt_mutate_the_word
26
+ token = Chronic::Token.new('foo')
27
+ token.inspect
28
+ assert_equal 'foo', token.word
29
+ end
30
+
31
+ end
metadata ADDED
@@ -0,0 +1,218 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: chronic-davispuh
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.10.2.v0.1da32066b3f46f2506b3471e39557497e34afa27
5
+ platform: ruby
6
+ authors:
7
+ - Tom Preston-Werner
8
+ - Lee Jarvis
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2017-08-20 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: numerizer
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '0.2'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '0.2'
28
+ - !ruby/object:Gem::Dependency
29
+ name: tzinfo
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: TimezoneParser
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rake
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '10'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '10'
70
+ - !ruby/object:Gem::Dependency
71
+ name: simplecov
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: minitest
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: '5.0'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: '5.0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: activesupport
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - "~>"
103
+ - !ruby/object:Gem::Version
104
+ version: '4'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - "~>"
110
+ - !ruby/object:Gem::Version
111
+ version: '4'
112
+ description: Chronic is a natural language date/time parser written in pure Ruby.
113
+ email:
114
+ - tom@mojombo.com
115
+ - ljjarvis@gmail.com
116
+ executables: []
117
+ extensions: []
118
+ extra_rdoc_files:
119
+ - README.md
120
+ - HISTORY.md
121
+ - LICENSE
122
+ files:
123
+ - ".gitignore"
124
+ - ".travis.yml"
125
+ - Gemfile
126
+ - HISTORY.md
127
+ - LICENSE
128
+ - README.md
129
+ - Rakefile
130
+ - chronic.gemspec
131
+ - lib/chronic.rb
132
+ - lib/chronic/arrow.rb
133
+ - lib/chronic/date.rb
134
+ - lib/chronic/definition.rb
135
+ - lib/chronic/dictionary.rb
136
+ - lib/chronic/handler.rb
137
+ - lib/chronic/handlers/anchor.rb
138
+ - lib/chronic/handlers/arrow.rb
139
+ - lib/chronic/handlers/date.rb
140
+ - lib/chronic/handlers/date_time.rb
141
+ - lib/chronic/handlers/general.rb
142
+ - lib/chronic/handlers/narrow.rb
143
+ - lib/chronic/handlers/time.rb
144
+ - lib/chronic/handlers/time_zone.rb
145
+ - lib/chronic/objects/anchor_object.rb
146
+ - lib/chronic/objects/arrow_object.rb
147
+ - lib/chronic/objects/date_object.rb
148
+ - lib/chronic/objects/date_time_object.rb
149
+ - lib/chronic/objects/handler_object.rb
150
+ - lib/chronic/objects/narrow_object.rb
151
+ - lib/chronic/objects/time_object.rb
152
+ - lib/chronic/objects/time_zone_object.rb
153
+ - lib/chronic/parser.rb
154
+ - lib/chronic/span.rb
155
+ - lib/chronic/tag.rb
156
+ - lib/chronic/tags/day_name.rb
157
+ - lib/chronic/tags/day_portion.rb
158
+ - lib/chronic/tags/day_special.rb
159
+ - lib/chronic/tags/grabber.rb
160
+ - lib/chronic/tags/keyword.rb
161
+ - lib/chronic/tags/month_name.rb
162
+ - lib/chronic/tags/ordinal.rb
163
+ - lib/chronic/tags/pointer.rb
164
+ - lib/chronic/tags/rational.rb
165
+ - lib/chronic/tags/scalar.rb
166
+ - lib/chronic/tags/season_name.rb
167
+ - lib/chronic/tags/separator.rb
168
+ - lib/chronic/tags/sign.rb
169
+ - lib/chronic/tags/time_special.rb
170
+ - lib/chronic/tags/time_zone.rb
171
+ - lib/chronic/tags/unit.rb
172
+ - lib/chronic/time.rb
173
+ - lib/chronic/time_zone.rb
174
+ - lib/chronic/token.rb
175
+ - lib/chronic/token_group.rb
176
+ - lib/chronic/tokenizer.rb
177
+ - lib/chronic/version.rb
178
+ - test/helper.rb
179
+ - test/test_chronic.rb
180
+ - test/test_daylight_savings.rb
181
+ - test/test_handler.rb
182
+ - test/test_parsing.rb
183
+ - test/test_span.rb
184
+ - test/test_token.rb
185
+ homepage: http://github.com/mojombo/chronic
186
+ licenses:
187
+ - MIT
188
+ metadata: {}
189
+ post_install_message:
190
+ rdoc_options:
191
+ - "--charset=UTF-8"
192
+ require_paths:
193
+ - lib
194
+ required_ruby_version: !ruby/object:Gem::Requirement
195
+ requirements:
196
+ - - ">="
197
+ - !ruby/object:Gem::Version
198
+ version: '0'
199
+ required_rubygems_version: !ruby/object:Gem::Requirement
200
+ requirements:
201
+ - - ">"
202
+ - !ruby/object:Gem::Version
203
+ version: 1.3.1
204
+ requirements: []
205
+ rubyforge_project: chronic
206
+ rubygems_version: 2.6.8
207
+ signing_key:
208
+ specification_version: 4
209
+ summary: Natural language date/time parsing.
210
+ test_files:
211
+ - test/helper.rb
212
+ - test/test_chronic.rb
213
+ - test/test_daylight_savings.rb
214
+ - test/test_handler.rb
215
+ - test/test_parsing.rb
216
+ - test/test_span.rb
217
+ - test/test_token.rb
218
+ has_rdoc: