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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4ed1679d8461e9701052f12181183d27973a6fd7
4
- data.tar.gz: 17f617ef6025bf2693bf50b5d09a2fff1bce5c2c
3
+ metadata.gz: 8f4f9a373147c408c3f581d43655a3c5e61a6bff
4
+ data.tar.gz: ed6247261947a62288897bd3688b198e6ed0d776
5
5
  SHA512:
6
- metadata.gz: e286704a3e04cd513e1d845ac4a627aeaa9e939bfd4afe39aeda42487fb3c2add2f24d9ff657c4160da54fece42ddeb08d30bcc01f85a99afd1931bcd45b2f8e
7
- data.tar.gz: 7736bdcc6a50e469e64d488dd8fb1673d7ebf33854c8ca0501e1513b1d23fa6ba39738b7c450d74520f108e4154ae0ea7228c62352efbcb9e8a512114cdc2ae9
6
+ metadata.gz: 82cd3d2589d8043d979284708f97ab9e21ff471cc31d7e65c4af301aa36b0df51cbe3b1ad1d624f8cf24a5ee39cd313f58f3f27850f3b4057481787e44a89335
7
+ data.tar.gz: ba4368bfbb05f9c00df02c11d4a718c1a0de5644cde3e02ab5b9c0be79ad173e744791da1da3fb8596a1c3c7f16cf8c65d4c9063262e8b0758242eedd84b46ac
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.7.0
1
+ 1.7.1
@@ -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
- /^#{@@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+\)/
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
@@ -16,6 +16,6 @@ Gem::Specification.new do |spec|
16
16
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
17
  spec.require_paths = ["lib"]
18
18
 
19
- #spec.add_dependency 'active_support'
19
+ spec.add_development_dependency 'activesupport'
20
20
 
21
21
  end
data/test/test_obj.rb ADDED
@@ -0,0 +1,13 @@
1
+ require "str2duck"
2
+ require 'minitest/autorun'
3
+ describe 'StringParse' do
4
+
5
+ specify 'test a specific object' do
6
+
7
+ puts "2014-11-04T15:46:06Z".to_duck
8
+ puts "2014-11-04T15:46:06Z".to_duck.class
9
+
10
+ end
11
+
12
+ end
13
+
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.0
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-10-17 00:00:00.000000000 Z
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: