dates_from_string 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/dates_from_string.gemspec +1 -2
- data/lib/dates_from_string/version.rb +1 -1
- data/lib/dates_from_string.rb +15 -0
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73877f49465debf1fa374b163656386cd99206fd
|
4
|
+
data.tar.gz: 7fbc7b752866edaa5056e1eac7b1a30db0aaf8a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 577691d70ca2c10ab26a9526e6f7916d980f343fea914d2cfb689e664e699bb07697eb52bfefb516a0e6b358543e8ac5caa841490e593125a6701cbaa9e7c4f9
|
7
|
+
data.tar.gz: 30a1e8bd95c8dd14b574f10007de3df16107ee0142b0775d687760fcccd5dcd74ecd1c6cc42641a68ae0e8b7e2c1f4fdcc882f574cd1440abc7a8b4064a090a8
|
data/dates_from_string.gemspec
CHANGED
@@ -17,11 +17,10 @@ Gem::Specification.new do |spec|
|
|
17
17
|
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
18
|
# delete this section to allow pushing this gem to any host.
|
19
19
|
# if spec.respond_to?(:metadata)
|
20
|
-
#
|
20
|
+
# spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
21
21
|
# else
|
22
22
|
# raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
23
|
# end
|
24
|
-
# spec.metadata['allowed_push_host'] = 'https://gems.https://rubygems.org/gems/to_net_me_apiy.example'
|
25
24
|
|
26
25
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
27
26
|
spec.bindir = "exe"
|
data/lib/dates_from_string.rb
CHANGED
@@ -20,6 +20,7 @@ class DatesFromString
|
|
20
20
|
value_year = get_year(data)
|
21
21
|
value_full_date = get_full_date(data)
|
22
22
|
value_dash = get_dash_data(data)
|
23
|
+
value_month = get_month_by_list(data)
|
23
24
|
next_index = index + 1
|
24
25
|
|
25
26
|
if value_year
|
@@ -36,6 +37,10 @@ class DatesFromString
|
|
36
37
|
add_to_structure(:year ,value_dash[0], index, next_index, data_arr, '-')
|
37
38
|
add_to_structure(:year ,value_dash[1], index, next_index, data_arr)
|
38
39
|
end
|
40
|
+
|
41
|
+
if value_month
|
42
|
+
add_to_structure(:month ,value_month, index, next_index, data_arr)
|
43
|
+
end
|
39
44
|
end
|
40
45
|
|
41
46
|
return @main_arr
|
@@ -75,6 +80,16 @@ class DatesFromString
|
|
75
80
|
end
|
76
81
|
end
|
77
82
|
|
83
|
+
def get_month_by_list(string)
|
84
|
+
month = ['January','February','March','April','May','June','July','August','September','October','November','December']
|
85
|
+
index = month.index(string)
|
86
|
+
if index
|
87
|
+
sprintf('%02d',(index+1))
|
88
|
+
else
|
89
|
+
nil
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
78
93
|
def add_to_structure (type ,value, index, next_index, data_arr, key_word = nil)
|
79
94
|
set_structura
|
80
95
|
if value
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dates_from_string
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergey Chechaev
|
@@ -14,42 +14,42 @@ dependencies:
|
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.9'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.9'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '10.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: pry-rails
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
description: Find dates in string and return array of dates
|
@@ -59,9 +59,9 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
-
-
|
63
|
-
-
|
64
|
-
-
|
62
|
+
- .gitignore
|
63
|
+
- .rspec
|
64
|
+
- .travis.yml
|
65
65
|
- CODE_OF_CONDUCT.md
|
66
66
|
- Gemfile
|
67
67
|
- LICENSE.txt
|
@@ -82,17 +82,17 @@ require_paths:
|
|
82
82
|
- lib
|
83
83
|
required_ruby_version: !ruby/object:Gem::Requirement
|
84
84
|
requirements:
|
85
|
-
- -
|
85
|
+
- - '>='
|
86
86
|
- !ruby/object:Gem::Version
|
87
87
|
version: '0'
|
88
88
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
89
|
requirements:
|
90
|
-
- -
|
90
|
+
- - '>='
|
91
91
|
- !ruby/object:Gem::Version
|
92
92
|
version: '0'
|
93
93
|
requirements: []
|
94
94
|
rubyforge_project:
|
95
|
-
rubygems_version: 2.
|
95
|
+
rubygems_version: 2.0.14
|
96
96
|
signing_key:
|
97
97
|
specification_version: 4
|
98
98
|
summary: Flexible solution for finding all formats of dates in text
|