stairwell 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5dceead73a994b4e906bda027acdb5f7f4928513a367db2993b50a9f8d458c02
4
- data.tar.gz: 828b085bfd87dcd9d638546a3a5b31873d02e88a26bd15fd1bdaf0f6906b0a1f
3
+ metadata.gz: 7846f146e7d718b2c1dacaaf795e2093c3f24a5a4ee520a2821c6a3bb23d2ca2
4
+ data.tar.gz: 3b39deebbb1db67dd063953d92899b4cc4b94a96fda740a0c6b2173ef28e7c24
5
5
  SHA512:
6
- metadata.gz: 4f8347079a86f9c08e92b6ec48fdc50f2b2a6d6d4d156cc29c112996340fca5603a74679045fdca5b41af06519f9182ca97564846a30ab3420b5e983c46c7422
7
- data.tar.gz: 6e8b01048a84d35b9f999fca1809e638a98bd09dace22755f31ecbb756992745f9a1fa8fe469a4eabdee91baed4696219f301f137ab567424105679d054a2ec0
6
+ metadata.gz: 1e678fe8b202b64ba0d2abbd1771983fc2a72c9a757478c6cfac163af7985b68f8e2d47458a01715b81c756153f6858963cb6d3d59ed9223d089ff6fdebeb01e
7
+ data.tar.gz: 7fe23548a55c4ea1eb3f10d1ab8eb375699f7849e084af9346eee041fef19c5129558952b662d4814adbb0439f5e5af17bce02f27884f58fc0e8c3adf01dc483
@@ -1,8 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- stairwell (0.1.0)
5
- zeitwerk (~> 2.4.0)
4
+ stairwell (0.1.1)
6
5
 
7
6
  GEM
8
7
  remote: https://rubygems.org/
@@ -14,7 +13,6 @@ GEM
14
13
  coderay (~> 1.1)
15
14
  method_source (~> 1.0)
16
15
  rake (12.3.3)
17
- zeitwerk (2.4.0)
18
16
 
19
17
  PLATFORMS
20
18
  ruby
@@ -48,6 +48,12 @@ class Float
48
48
  end
49
49
  end
50
50
 
51
+ class Array
52
+ def sql_quote
53
+ map(&:sql_quote).join(", ")
54
+ end
55
+ end
56
+
51
57
  class Date
52
58
  def self.parsable?(string)
53
59
  begin
@@ -2,7 +2,7 @@ module Stairwell
2
2
  class Query
3
3
 
4
4
  class << self
5
- attr_accessor :bind_hash, :all_validations, :sql_string, :bind_object_array
5
+ attr_accessor :bind_hash, :all_validations, :sql_string
6
6
 
7
7
  def validate_type(*args)
8
8
  @all_validations ||= {}
@@ -11,7 +11,6 @@ module Stairwell
11
11
 
12
12
  def sql(**args)
13
13
  @bind_hash = args
14
- @bind_object_array = []
15
14
  validate!
16
15
  transformed_sql_string
17
16
  end
@@ -27,6 +26,7 @@ module Stairwell
27
26
 
28
27
  bind_hash.each do |bind_name, bind_value|
29
28
  type = all_validations[bind_name]
29
+ type = type.first if type.is_a?(Array)
30
30
  valid = TypeValidator.send(type, bind_value)
31
31
 
32
32
  raise InvalidBindType.new("#{bind_name} is not #{all_validations[bind_name]}") unless valid
@@ -16,7 +16,8 @@ module Stairwell
16
16
 
17
17
  TYPES.each do |type|
18
18
  define_method(type.to_s.underscore.to_sym) do |arg|
19
- arg.is_a?(type)
19
+ return arg.is_a?(type) unless arg.is_a?(Array)
20
+ arg.all? { |element| element.is_a?(type) }
20
21
  end
21
22
  end
22
23
  end
@@ -1,3 +1,3 @@
1
1
  module Stairwell
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: stairwell
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
  - tobyond
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-20 00:00:00.000000000 Z
11
+ date: 2020-09-21 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Sanitize and quote raw SQL for rails and any project in ruby
14
14
  email: