str2duck 1.7.0 → 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/str2duck/regexp.rb +3 -2
- data/str2duck.gemspec +1 -1
- data/test/test_obj.rb +13 -0
- data/test/test_parse.rb +15 -14
- metadata +19 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f4f9a373147c408c3f581d43655a3c5e61a6bff
|
4
|
+
data.tar.gz: ed6247261947a62288897bd3688b198e6ed0d776
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82cd3d2589d8043d979284708f97ab9e21ff471cc31d7e65c4af301aa36b0df51cbe3b1ad1d624f8cf24a5ee39cd313f58f3f27850f3b4057481787e44a89335
|
7
|
+
data.tar.gz: ba4368bfbb05f9c00df02c11d4a718c1a0de5644cde3e02ab5b9c0be79ad173e744791da1da3fb8596a1c3c7f16cf8c65d4c9063262e8b0758242eedd84b46ac
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.7.
|
1
|
+
1.7.1
|
data/lib/str2duck/regexp.rb
CHANGED
@@ -10,8 +10,9 @@ module Str2Duck
|
|
10
10
|
answer_value= nil
|
11
11
|
[
|
12
12
|
/^\w+, \d+ \w+ #{@@year} \d\d:\d\d:\d\d \+\d+$/,
|
13
|
-
|
14
|
-
/\w+ \w+ \d+ #{@@year} \d+:\d+:\d+ \w+\+\d+ \(\w+\)
|
13
|
+
/^-?#{@@year}-\d\d-\d\d\w\d\d:\d\d:\d\d\+\d\d:\d\d$/,
|
14
|
+
/\w+ \w+ \d+ #{@@year} \d+:\d+:\d+ \w+\+\d+ \(\w+\)/,
|
15
|
+
/^-?\d+-\d\d?-\d\d?\w\d\d?:\d\d?:\d\d?\w$/
|
15
16
|
].each do |regexp|
|
16
17
|
answer_value ||= obj =~ regexp
|
17
18
|
end
|
data/str2duck.gemspec
CHANGED
data/test/test_obj.rb
ADDED
data/test/test_parse.rb
CHANGED
@@ -5,20 +5,21 @@ describe 'StringParse' do
|
|
5
5
|
specify 'parse objects into the right format' do
|
6
6
|
|
7
7
|
{
|
8
|
-
"2011-03-12"=>Date,
|
9
|
-
"2007-07-20 18:59:27 +0200"=>Time,
|
10
|
-
"2010-10-30 18:02:56 +0200"=>Time,
|
11
|
-
"2012-09-12T14:49:50+02:00"=>DateTime,
|
12
|
-
"123"=>Fixnum,
|
13
|
-
"asd"=>String,
|
14
|
-
"123.432"=>Float,
|
15
|
-
"123,432"=>Float,
|
16
|
-
"true"=>TrueClass,
|
17
|
-
"false"=>FalseClass,
|
18
|
-
"some string data"=>String,
|
19
|
-
"{\"hello\":\"json\"}"=>Hash,
|
20
|
-
"--- hello\n..."=>String,
|
21
|
-
"hello: yaml"=>Hash
|
8
|
+
"2011-03-12" => Date,
|
9
|
+
"2007-07-20 18:59:27 +0200" => Time,
|
10
|
+
"2010-10-30 18:02:56 +0200" => Time,
|
11
|
+
"2012-09-12T14:49:50+02:00" => DateTime,
|
12
|
+
"123" => Fixnum,
|
13
|
+
"asd" => String,
|
14
|
+
"123.432" => Float,
|
15
|
+
"123,432" => Float,
|
16
|
+
"true" => TrueClass,
|
17
|
+
"false" => FalseClass,
|
18
|
+
"some string data" => String,
|
19
|
+
"{\"hello\":\"json\"}" => Hash,
|
20
|
+
"--- hello\n..." => String,
|
21
|
+
"hello: yaml" => Hash,
|
22
|
+
"2014-11-04T15:46:06Z" => DateTime
|
22
23
|
}.each_pair do |str,klass|
|
23
24
|
str.to_duck.must_be_instance_of klass
|
24
25
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: str2duck
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Luzsi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
12
|
-
dependencies:
|
11
|
+
date: 2014-11-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
description: " Parse string into obj "
|
14
28
|
email:
|
15
29
|
- adamluzsi@gmail.com
|
@@ -32,6 +46,7 @@ files:
|
|
32
46
|
- lib/str2duck/parser.rb
|
33
47
|
- lib/str2duck/regexp.rb
|
34
48
|
- str2duck.gemspec
|
49
|
+
- test/test_obj.rb
|
35
50
|
- test/test_parse.rb
|
36
51
|
homepage: https://github.com/adamluzsi/str2duck
|
37
52
|
licenses: []
|
@@ -57,5 +72,6 @@ signing_key:
|
|
57
72
|
specification_version: 4
|
58
73
|
summary: String to Obj, Duck type parser
|
59
74
|
test_files:
|
75
|
+
- test/test_obj.rb
|
60
76
|
- test/test_parse.rb
|
61
77
|
has_rdoc:
|