dates_from_string 0.9.2 → 0.9.3

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: d486dcca01fb31dd1c983b77d997f573c8588023
4
- data.tar.gz: 483ea64e4c3e06355b95fb35f20635b188548f78
3
+ metadata.gz: 5127fb4b47b2bc71ba5f4c559098307955a01f87
4
+ data.tar.gz: a0b580abb53ca6b7411e4dd3376372fb0e343df8
5
5
  SHA512:
6
- metadata.gz: ed1b1e8182907904253f9e60f85776677e0ab4ab466ed498e49d994938713d21d7d4d676b5d1bc355dcd78622156839789e8e1f65b5197fe51123d1414fd816d
7
- data.tar.gz: 74f2b4c078549bb7cfddd2e8b78ebf0b39bf7bec4ba39fcb830e68cfd788b77794024652c5d9cabd29e4e99cdab671699294e7f9276d6c583350a68b56e4d946
6
+ metadata.gz: 34d58952331c9f5647e1f261f5748b5d2ab81016d79e28dac54147368c099d7a4f5669e196caf966039172ae3a55601049e5bcefdc6b5225e0fdde5136b8ea75
7
+ data.tar.gz: 05d37983afa4191afacc8219c2d69c561649dabe0b676b0d61168c01aaaaea2922a4b427900538b2a79d6960c5111e52d95d270a246f8e41988acaebb75e25ef
@@ -1,3 +1,3 @@
1
1
  class DatesFromString
2
- VERSION = "0.9.2"
2
+ VERSION = "0.9.3"
3
3
  end
@@ -1,5 +1,5 @@
1
1
  require "dates_from_string/version"
2
-
2
+ require "parsing_structure"
3
3
 
4
4
  class DatesFromString
5
5
 
@@ -7,8 +7,9 @@ class DatesFromString
7
7
  @key_words = key_words
8
8
  end
9
9
 
10
- def find_date(sructure)
11
-
10
+ def find_date(string)
11
+ parsing_structure = ParsingStructure.new(get_structure(string))
12
+ parsing_structure.start
12
13
  end
13
14
 
14
15
  def get_structure(string)
@@ -0,0 +1,35 @@
1
+ require "dates_from_string/version"
2
+
3
+ class ParsingStructure
4
+
5
+ def initialize(structure)
6
+ @structure = structure
7
+ end
8
+
9
+ def start
10
+ array_of_full_data = []
11
+ year = nil
12
+ month = nil
13
+ day = nil
14
+
15
+ @structure.each do |item|
16
+ if item[:type] == :year && item[:distance] == 0
17
+ year = item[:value]
18
+ end
19
+
20
+ if item[:type] == :month && item[:distance] == 0
21
+ month = item[:value]
22
+ end
23
+
24
+ if item[:type] == :day && item[:distance] == 0
25
+ day = item[:value]
26
+ end
27
+
28
+ if year && month && day
29
+ array_of_full_data << [year,month,day].join("-")
30
+ end
31
+ end
32
+
33
+ array_of_full_data
34
+ end
35
+ end
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dates_from_string
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Chechaev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-05-07 00:00:00.000000000 Z
11
+ date: 2015-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
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: :development
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: Flexible solution for finding all formats of dates in text
@@ -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
@@ -72,6 +72,7 @@ files:
72
72
  - dates_from_string.gemspec
73
73
  - lib/dates_from_string.rb
74
74
  - lib/dates_from_string/version.rb
75
+ - lib/parsing_structure.rb
75
76
  homepage: ''
76
77
  licenses:
77
78
  - MIT
@@ -82,17 +83,17 @@ require_paths:
82
83
  - lib
83
84
  required_ruby_version: !ruby/object:Gem::Requirement
84
85
  requirements:
85
- - - '>='
86
+ - - ">="
86
87
  - !ruby/object:Gem::Version
87
88
  version: '0'
88
89
  required_rubygems_version: !ruby/object:Gem::Requirement
89
90
  requirements:
90
- - - '>='
91
+ - - ">="
91
92
  - !ruby/object:Gem::Version
92
93
  version: '0'
93
94
  requirements: []
94
95
  rubyforge_project:
95
- rubygems_version: 2.0.14
96
+ rubygems_version: 2.2.2
96
97
  signing_key:
97
98
  specification_version: 4
98
99
  summary: Flexible solution for finding all formats of dates in text