array_hasher 0.1.1 → 0.1.2

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: 87617c796c0a842da0e95ee0162cc0b3f4373764
4
- data.tar.gz: 0abd1ee99677128f719ec39a826e8adf08571b48
3
+ metadata.gz: cf66523ac3b7dd4379f29cf3021d66033637b7bf
4
+ data.tar.gz: 27b9d366d360cbcf9d322635f538201e8adebeb0
5
5
  SHA512:
6
- metadata.gz: 75529015460920dd6a5eedc727b3b56653c79433d7a4a87440a90b20ea90f06f7218e95c7390e5b36eb5e1c43a5fe0a69fe23f4a3e317e0b0950de9f511d3f05
7
- data.tar.gz: 9163dabdb96b4384e8154534b7d70e00c7c7024aeeafdc5faff0873eee2f58b1f34bd08feff8fd66c160cffc4ce15496d19f2c30e090fdc0f6eaad2e01fbcf1b
6
+ metadata.gz: 37ba57202e61fefcec97f8ab6475f0c06ccd6724d9f190cb99f6277f713273995378c3eda604f689183f8e14bb9e03361f0b432446429dd21b141abea1a532a5
7
+ data.tar.gz: e468dfad8a405605c995fa73abbe227de8b4525f1917060afa2b6f52b1770ac8ffc0c70ec20363330735831090423287224d9fa631a7099f828362ec642ecfb5
data/.gitignore CHANGED
@@ -9,6 +9,7 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+ /spec/examples.txt
12
13
 
13
14
  *.swp
14
15
  *.gem
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- array_hasher (0.1.1)
4
+ array_hasher (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -32,4 +32,4 @@ DEPENDENCIES
32
32
  rspec (~> 3.0)
33
33
 
34
34
  BUNDLED WITH
35
- 1.16.0.pre.2
35
+ 1.16.0
data/README.md CHANGED
@@ -74,6 +74,10 @@ end
74
74
  # {:name=>"<Your book>", :price=>1.2, :tags=>["Hehe", "Haha", "666"]}
75
75
  ```
76
76
 
77
+ ### Examples
78
+
79
+ See [Here](./examples)
80
+
77
81
  ## Default Types
78
82
 
79
83
  * `int` # convert string to int
@@ -82,6 +86,7 @@ end
82
86
  * `time` # Time.parse(string)
83
87
  * `Proc` # format the value with your proc
84
88
 
89
+
85
90
  ## Development
86
91
 
87
92
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -7,10 +7,10 @@ module ArrayHasher
7
7
  REGEXP_EMPTY = /\A\s*\z/
8
8
 
9
9
  TYPES = {
10
- int: Proc.new {|v| v =~ REGEXP_EMPTY ? nil : v.gsub(/\A[^\d]+/, '').to_i },
11
- float: Proc.new {|v| v =~ REGEXP_EMPTY ? nil : v.gsub(/\A[^\d]+/, '').to_f },
10
+ int: Proc.new {|v| (v.nil? || v =~ REGEXP_EMPTY) ? nil : v.gsub(/\A[^\d]+/, '').to_i },
11
+ float: Proc.new {|v| (v.nil? || v =~ REGEXP_EMPTY) ? nil : v.gsub(/\A[^\d]+/, '').to_f },
12
12
  string: Proc.new {|v| v.to_s },
13
- time: Proc.new {|v| Time.parse(v) }
13
+ time: Proc.new {|v| v ? Time.parse(v) : nil }
14
14
  }
15
15
 
16
16
  # cols:
@@ -1,3 +1,3 @@
1
1
  module ArrayHasher
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: array_hasher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - jiangzhi.xie
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-19 00:00:00.000000000 Z
11
+ date: 2017-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler