mini_sql 0.1.7 → 0.1.8

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
  SHA256:
3
- metadata.gz: 9d169e7c71482b8e7f84b97a544a0731b16215252e5cf3b8ce347c1448a79f69
4
- data.tar.gz: b93ea22bfe34a4e0d7aca2ef66468f636647549700a871cd045f7d6f57843024
3
+ metadata.gz: c805e0578de8d26ad5b1ab75e0a43e11fa87cfa7742f872405598d26194537d0
4
+ data.tar.gz: 26cc5f52280ef8fe6fd031f7aceb0fc696765259f81ce472353d127a9b216107
5
5
  SHA512:
6
- metadata.gz: 7b32d5252ecab4173e43de3dfa4b92e492c30e74935dbd55cbb2172d73dc308b478a4547ba87ea217e049a6ea2c24fcd1116e092447f8166a93e2e920d2b15af
7
- data.tar.gz: 958415ac8d8c1091ea3e35ac3b9c10c0056c336b513d8124b89029409667f0ce3f319a50f946e6cd7cff94610158112f2d134b954d9fe61d2afb4c6a0ab0cd57
6
+ metadata.gz: 3b420b642d7e64839037eeb9ba7204ff654ae536e097cbe9e02c510753d98cb06f4e6d811975bd400f6b8b28d7e29dfa7dbcd5aeee34bbec42133fc6c3c5e166
7
+ data.tar.gz: f505f8ec94c6bf04c977eddedaffdcd5dadb6825e49e09b9f8f37652bfc6846831c39b63bac913a9e70aea4cc50400a2c8b6d761fae9c415ae12e1f4f3f8fddf
@@ -11,8 +11,8 @@ class MiniSql::Builder
11
11
 
12
12
  [:set, :where2, :where, :order_by, :limit, :left_join, :join, :offset, :select].each do |k|
13
13
  define_method k do |data, *args|
14
- @args ||= {}
15
- if Hash === args
14
+ if Hash === args && args.length > 0
15
+ @args ||= {}
16
16
  @args.merge!(args)
17
17
  elsif args && args.length > 0
18
18
  data = @connection.param_encoder.encode(data, *args)
@@ -56,7 +56,13 @@ class MiniSql::Builder
56
56
  class_eval <<~RUBY
57
57
  def #{m}(hash_args = nil)
58
58
  hash_args = @args.merge(hash_args) if hash_args && @args
59
- @connection.#{m}(to_sql, hash_args || @args)
59
+ hash_args ||= @args
60
+
61
+ if hash_args
62
+ @connection.#{m}(to_sql, hash_args)
63
+ else
64
+ @connection.#{m}(to_sql)
65
+ end
60
66
  end
61
67
  RUBY
62
68
  end
@@ -1,3 +1,3 @@
1
1
  module MiniSql
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mini_sql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Saffron