multi_insert 0.1.5 → 0.1.6

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: d2cb2fa25faf5caea3683a65aca0eeefe44b8f89
4
- data.tar.gz: 89399e5dceae78ae2184c608263597312a1c3c7f
3
+ metadata.gz: 6532ebc746eaa544c406349ddd1817bc149046a7
4
+ data.tar.gz: 8ebbc32e07ee43e5958c96c0dbdf04e45a172b46
5
5
  SHA512:
6
- metadata.gz: 7a9c0237d382d21c3dde8dd22c5d927180f7e717b02b4b3e89e68a21fe4e881a17a6585fb72987d8fa022feeab36bdf089575d9d93f31790320ff8aabd745629
7
- data.tar.gz: 434040ac3bf724ddad1fd683ed74cc56759d470e99be74b43eabf10b782e9504e21c57945cf0a32e486e9e0a107e66ab4c14823d8a97763ab8ac90f0d830b615
6
+ metadata.gz: ac08e898e86852fa1bf278a36b9900058ed8f1881d93e8bbfb27ea068aaf521646c040d38599d3871ff2c2a02b9d63a860732355d931fc00c00f5e3a11cb334c
7
+ data.tar.gz: 49fab8f4e8ac646e09b64dd2b1951179bf102150ca89ff3174263c91e75ee98895bb937ab2971e7c35b7a96f49632080fe9a1be51f526a4fc624d4ef5c6211fb
@@ -5,19 +5,18 @@ module MultiInsert
5
5
  def self.insert(table, columns, values, opts = {})
6
6
  ar = ActiveRecord::Base.connection
7
7
 
8
- options = {time: true}
9
- options.merge!(opts)
8
+ opts.merge!({time: true})
10
9
 
11
- now = Time.now.to_s(:db) if options[:time]
10
+ now = Time.now.to_s(:db) if opts[:time]
12
11
  table = ar.quote_table_name(table.to_s)
13
12
 
14
13
  # Format columns
15
- columns = columns + [:created_at, :updated_at] if options[:time]
14
+ columns = columns + [:created_at, :updated_at] if opts[:time]
16
15
  columns = columns.map!{|c| ar.quote_column_name(c.to_s)}
17
16
  columns = join_params(columns)
18
17
 
19
18
  # Format values
20
- if options[:time]
19
+ if opts[:time]
21
20
  values = values.map{|v| v + [now, now]}
22
21
  end
23
22
  values = values.map{|v| join_params(v.map{|vv| ar.quote(vv.to_s)})}.join(',')
@@ -1,3 +1,3 @@
1
1
  module MultiInsert
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multi_insert
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nax