international_date_parser 0.3.0 → 0.3.2
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.
- checksums.yaml +4 -4
- metadata +46 -13
- data/.gitignore +0 -15
- data/Gemfile +0 -23
- data/Guardfile +0 -46
- data/LICENSE.txt +0 -22
- data/README.md +0 -21
- data/Rakefile +0 -2
- data/international_date_parser.gemspec +0 -26
- data/lib/international_date_parser/railtie.rb +0 -6
- data/lib/international_date_parser/version.rb +0 -6
- data/spec/lib/international_date_parser_spec.rb +0 -57
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bf48c33bd53edf597dc1be0503b48551604f4a2d7810ce83b49962008d3f595
|
4
|
+
data.tar.gz: 42ff687a4d673484b6c4ee694eab1bae4d37a0bceaa5e92cca464ab9fa3321c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27b10e2ab47062e9d9525135b4e8112e6a60ff4407c316f928ce088058c337ae34015d2b009072dafb1cf592c7ab688ad746d3375a5a856b394ead05e98d94bd
|
7
|
+
data.tar.gz: 733b03bb939545013e4c8a4535bc62ad9d7ce7fe7953603701960773396040d2d59efe55392d6e59a7ab0eeb7a7a62d3710c45bda51d9eea02ced41f6ea3d133
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: international_date_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Humberto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,24 +52,57 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '8.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: guard-rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: simplecov
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
55
97
|
description: Ruby class Date extension to translate months and then parse the string
|
98
|
+
or array
|
56
99
|
email:
|
57
100
|
- hlsp999@gmail.com
|
58
101
|
executables: []
|
59
102
|
extensions: []
|
60
103
|
extra_rdoc_files: []
|
61
104
|
files:
|
62
|
-
- ".gitignore"
|
63
|
-
- Gemfile
|
64
|
-
- Guardfile
|
65
|
-
- LICENSE.txt
|
66
|
-
- README.md
|
67
|
-
- Rakefile
|
68
|
-
- international_date_parser.gemspec
|
69
105
|
- lib/international_date_parser.rb
|
70
|
-
- lib/international_date_parser/railtie.rb
|
71
|
-
- lib/international_date_parser/version.rb
|
72
|
-
- spec/lib/international_date_parser_spec.rb
|
73
106
|
homepage: http://github.com/frenesim/international_date_parser
|
74
107
|
licenses:
|
75
108
|
- MIT
|
@@ -93,5 +126,5 @@ rubyforge_project:
|
|
93
126
|
rubygems_version: 2.7.7
|
94
127
|
signing_key:
|
95
128
|
specification_version: 4
|
96
|
-
summary:
|
129
|
+
summary: Parse string and arrays to date
|
97
130
|
test_files: []
|
data/.gitignore
DELETED
data/Gemfile
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in international_date_parser.gemspec
|
4
|
-
|
5
|
-
gemspec
|
6
|
-
|
7
|
-
gem 'rspec'
|
8
|
-
gem 'guard-rspec'
|
9
|
-
|
10
|
-
# require 'lib/internation_date_parser/version'
|
11
|
-
|
12
|
-
Gem::Specification.new do |s|
|
13
|
-
s.name = 'example'
|
14
|
-
s.version = '0.3.0'
|
15
|
-
s.licenses = ['MIT']
|
16
|
-
s.summary = "parse string and arrays to date"
|
17
|
-
s.description = "Parse string or array that are in some languages to date"
|
18
|
-
s.authors = ["Humbero Pinto"]
|
19
|
-
s.email = 'hls.p999@gmail.com'
|
20
|
-
s.files = ["lib/international_date_parser.rb"]
|
21
|
-
s.homepage = 'https://rubygems.org/gems/international_date_parser'
|
22
|
-
# s.metadata = { "source_code_uri" => "https://github.com/example/example" }
|
23
|
-
end
|
data/Guardfile
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
# A sample Guardfile
|
2
|
-
# More info at https://github.com/guard/guard#readme
|
3
|
-
|
4
|
-
## Uncomment and set this to only include directories you want to watch
|
5
|
-
# directories %w(app lib config test spec features) \
|
6
|
-
# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
7
|
-
|
8
|
-
## Note: if you are using the `directories` clause above and you are not
|
9
|
-
## watching the project directory ('.'), then you will want to move
|
10
|
-
## the Guardfile to a watched dir and symlink it back, e.g.
|
11
|
-
#
|
12
|
-
# $ mkdir config
|
13
|
-
# $ mv Guardfile config/
|
14
|
-
# $ ln -s config/Guardfile .
|
15
|
-
#
|
16
|
-
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
17
|
-
|
18
|
-
|
19
|
-
# Note: The cmd option is now required due to the increasing number of ways
|
20
|
-
# rspec may be run, below are examples of the most common uses.
|
21
|
-
# * bundler: 'bundle exec rspec'
|
22
|
-
# * bundler binstubs: 'bin/rspec'
|
23
|
-
# * spring: 'bin/rspec' (This will use spring if running and you have
|
24
|
-
# installed the spring binstubs per the docs)
|
25
|
-
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
26
|
-
# * 'just' rspec: 'rspec'
|
27
|
-
|
28
|
-
guard :rspec, cmd: "bundle exec rspec" do
|
29
|
-
require "guard/rspec/dsl"
|
30
|
-
dsl = Guard::RSpec::Dsl.new(self)
|
31
|
-
|
32
|
-
# Feel free to open issues for suggestions and improvements
|
33
|
-
|
34
|
-
# RSpec files
|
35
|
-
rspec = dsl.rspec
|
36
|
-
watch(rspec.spec_helper) { rspec.spec_dir }
|
37
|
-
watch(rspec.spec_support) { rspec.spec_dir }
|
38
|
-
watch(rspec.spec_files)
|
39
|
-
|
40
|
-
# Ruby files
|
41
|
-
ruby = dsl.ruby
|
42
|
-
dsl.watch_spec_files_for(ruby.lib_files)
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
end
|
data/LICENSE.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2015 Humberto
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# International Date Parser
|
2
|
-
|
3
|
-
|
4
|
-
#### Purpose:
|
5
|
-
Extend the date parsing capabilities of Ruby to work with dates which months are different than english.
|
6
|
-
|
7
|
-
#### Usage:
|
8
|
-
```
|
9
|
-
InternationalDateParser::Date.parse_international("28 de Fevereiro de 2020")
|
10
|
-
InternationalDateParser::Date.parse_international("28 abr 2020")
|
11
|
-
|
12
|
-
```
|
13
|
-
|
14
|
-
#### Notes:
|
15
|
-
* This routine works by substituting your local month names (as defined by Date::MONTH_TRANSLATIONS) for the
|
16
|
-
international names when they occur in the date_string.
|
17
|
-
+ As distributed, this code works for French, German, Italian, Portuguese and Spanish. You must add the month
|
18
|
-
names for any additional languages you wish to handle.
|
19
|
-
|
20
|
-
## Inspired on a gist
|
21
|
-
https://github.com/jackrg
|
data/Rakefile
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'international_date_parser/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "international_date_parser"
|
8
|
-
spec.version = InternationalDateParser::VERSION
|
9
|
-
spec.authors = ["Humberto"]
|
10
|
-
spec.email = ["hlsp999@gmail.com"]
|
11
|
-
spec.summary = "International Date Parser "
|
12
|
-
spec.description = "Ruby class Date extension to translate months and then parse the string"
|
13
|
-
spec.homepage = 'http://github.com/frenesim/international_date_parser'
|
14
|
-
spec.license = "MIT"
|
15
|
-
|
16
|
-
spec.files = `git ls-files -z`.split("\x0")
|
17
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
-
#spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = ["lib"]
|
20
|
-
|
21
|
-
spec.add_development_dependency "bundler", "~> 1.7"
|
22
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
-
spec.add_development_dependency "byebug", "~> 8.2"
|
24
|
-
|
25
|
-
spec.required_ruby_version = '>= 1.9.3'
|
26
|
-
end
|
@@ -1,57 +0,0 @@
|
|
1
|
-
require 'international_date_parser'
|
2
|
-
RSpec.describe InternationalDateParser do
|
3
|
-
context 'class methods' do
|
4
|
-
describe 'international_date_parser' do
|
5
|
-
let :idp do
|
6
|
-
InternationalDateParser::Date
|
7
|
-
end
|
8
|
-
it 'is nil when input date is nil or empty' do
|
9
|
-
expect(idp.parse_international(nil)).to be nil
|
10
|
-
expect(idp.parse_international([])).to be nil
|
11
|
-
end
|
12
|
-
describe 'given a date without words' do
|
13
|
-
it 'returns a date if Ymd is given' do
|
14
|
-
expect(idp.parse_international('2011-01-01')).to eq Date.new(2011,01,01)
|
15
|
-
end
|
16
|
-
it 'returns a date if dmY is given' do
|
17
|
-
expect(idp.parse_international('01-01-2011')).to eq Date.new(2011,01,01)
|
18
|
-
end
|
19
|
-
it 'returns a date if ymd is given' do
|
20
|
-
expect(idp.parse_international('11-01-01')).to eq Date.new(2011,01,01)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
describe 'given a date in english' do
|
24
|
-
it 'returns a date' do
|
25
|
-
expect(idp.parse_international('2011 January 01')).to eq Date.new(2011,01,01)
|
26
|
-
expect(idp.parse_international('2011 Jan 01')).to eq Date.new(2011,01,01)
|
27
|
-
expect(idp.parse_international('01 January 2011')).to eq Date.new(2011,01,01)
|
28
|
-
expect(idp.parse_international('01 Jan 2011')).to eq Date.new(2011,01,01)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
describe 'given a date in portuguese' do
|
32
|
-
it 'returns a date' do
|
33
|
-
expect(idp.parse_international('2011 Fevereiro 01')).to eq Date.new(2011,02,01)
|
34
|
-
expect(idp.parse_international('2011 Fev 01')).to eq Date.new(2011,02,01)
|
35
|
-
expect(idp.parse_international('01 Fevereiro 2011')).to eq Date.new(2011,02,01)
|
36
|
-
expect(idp.parse_international('01 Fev 2011')).to eq Date.new(2011,02,01)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
describe 'given a date without the year' do
|
40
|
-
it 'returns a date' do
|
41
|
-
expect(idp.parse_international('Fevereiro 01')).to eq Date.new(2018,02,01)
|
42
|
-
expect(idp.parse_international('Fev 01')).to eq Date.new(2018,02,01)
|
43
|
-
expect(idp.parse_international('01 Fevereiro')).to eq Date.new(2018,02,01)
|
44
|
-
expect(idp.parse_international('01 Fev')).to eq Date.new(2018,02,01)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
describe 'given a date in array' do
|
48
|
-
it 'returns a date' do
|
49
|
-
expect(idp.parse_international(['Fevereiro 01'])).to eq Date.new(2018,02,01)
|
50
|
-
expect(idp.parse_international([[01],['Fev']])).to eq Date.new(2018,02,01)
|
51
|
-
expect(idp.parse_international([['Fev'],['01']])).to eq Date.new(2018,02,01)
|
52
|
-
expect(idp.parse_international([['Fev'],['01'],[2011]])).to eq Date.new(2011,02,01)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|