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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c3eaec4ffaa62880ca14ef7659225d39d42a3155
4
- data.tar.gz: f46e8e6c10ebe8b41bdd3d6e0f72b84ca866e49d
3
+ metadata.gz: 73877f49465debf1fa374b163656386cd99206fd
4
+ data.tar.gz: 7fbc7b752866edaa5056e1eac7b1a30db0aaf8a7
5
5
  SHA512:
6
- metadata.gz: 874f33bdc6c7eb29a72e1286380d4ed28996690ac08829754141948c3c41a6c79f1da91e4b979060d6d05247b9751712fd2395784387470c8094515d63c7da27
7
- data.tar.gz: 1ad064927b0caa09a5a903c9abe59d98146d3e028cfa8f034ce42b48cd0c535c1ae6f2e1eb0b9c6e7ae812dc11c0153057bb85b61c5a1234bf55e85e9af7c470
6
+ metadata.gz: 577691d70ca2c10ab26a9526e6f7916d980f343fea914d2cfb689e664e699bb07697eb52bfefb516a0e6b358543e8ac5caa841490e593125a6701cbaa9e7c4f9
7
+ data.tar.gz: 30a1e8bd95c8dd14b574f10007de3df16107ee0142b0775d687760fcccd5dcd74ecd1c6cc42641a68ae0e8b7e2c1f4fdcc882f574cd1440abc7a8b4064a090a8
@@ -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
- # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
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"
@@ -1,3 +1,3 @@
1
1
  class DatesFromString
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -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.1.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
- - ".gitignore"
63
- - ".rspec"
64
- - ".travis.yml"
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.4.6
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