ika 1.0.11 → 1.0.12

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: b34bad1546023a0d1f4e1bdd9af0ae68473bbf36
4
- data.tar.gz: 2de9d79ec32e2ea76245d2084cd59434a2248890
3
+ metadata.gz: dc3a9857afd1cd1f1b3e18273b2d698df2c4e19f
4
+ data.tar.gz: 4153e44d62da2100bf8cef338868c3b229dc17f2
5
5
  SHA512:
6
- metadata.gz: f023cacba74e3c8a8e606c1c6e5984678c13fcef1df440c3e6f0accaa69a62ea0830a44383904993545ba6c806079091dcfee54aa9d58d7aa9c10e92fc790b36
7
- data.tar.gz: 0d59771a41c0250942857b65bc298b26f4c95747c8288d663ce391b03e7bda6eaa0e484d185e36ad709452ec9c8f5e5a0588c9822a0e098229eee7ee7cf5dc3c
6
+ metadata.gz: 3eac737c70afa348306879f02029ee5592a3dcc8e58b74348cb75095423c652b738b1f2058111fd689b551f98ce39a176aea5ad1f2faabf436e2c59d35a7204d
7
+ data.tar.gz: 383ee4dfc605d8093b9cd69d2a6b0ad5673c6c78957396e76eac356c17a505f49b5058d8f8078687574d3d642b45d10d3834079b4cc04bba8a10ee6fd701fd62
@@ -16,16 +16,21 @@ module CarrierWave
16
16
  end
17
17
 
18
18
  def split_base64(uri_str)
19
- if uri_str.match(%r{data:(.*?);(.*?),(.*)$})
20
- uri = Hash.new
21
- uri[:type] = $1
22
- uri[:encoder] = $2
23
- uri[:data] = $3
24
- uri[:extension] = $1.split('/')[1]
25
- return uri
26
- else
27
- return nil
28
- end
19
+ # uri_str.match(%r{data:(.*?);(.*?),(.*)$})
20
+ a = uri_str.index(/^data:/)
21
+ return nil unless a
22
+ b = uri_str.index(/;/, a + 1)
23
+ return nil unless b
24
+ c = uri_str.index(/,/, b + 1)
25
+ return nil unless c
26
+
27
+ type = uri_str[a + 5, b - a - 5]
28
+ {
29
+ type: type,
30
+ encoder: uri_str[b + 1, c - b - 1],
31
+ data: uri_str[c + 1, uri_str.length - c - 1],
32
+ extension: type.split('/')[1]
33
+ }
29
34
  end
30
35
  end
31
36
  end
data/lib/ika/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ika
2
- VERSION = '1.0.11'
2
+ VERSION = '1.0.12'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ika
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.11
4
+ version: 1.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Makoto NAKAYA
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-04-21 00:00:00.000000000 Z
12
+ date: 2016-04-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails