torque-postgresql 0.1.3 → 0.1.4

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: 014c4d68ffa9d1de4f02d8f047353181a77c9b1f
4
- data.tar.gz: acf4391b79a96c8a62aa69e0f6040f76ae43f8fa
3
+ metadata.gz: a258d6ecef85609644383dcb9b0664d7cd475943
4
+ data.tar.gz: 759dfc6d12e06182ab2dcd7200cf28369da93c8c
5
5
  SHA512:
6
- metadata.gz: b98efaf4fb140e2d14bcae43cdbcbbbd2439bf70e770e4001a2ba547000bc6e3f15bca4b7ceab4daa845e581c983026f318ac6befa0517ff39c6f90a9e12bcfb
7
- data.tar.gz: 0a5fa71f9f8809fb405eae0ea15fc5943f7eb0b627301002157b6b5dac886e1443d5f4e793f69799411d4271db9c6f0d52f6df5baf71aa049b6d33526d9d2a6a
6
+ metadata.gz: b739abd40aa5039ac1869908a9dedf000487d03ec6741c192b4c48c47c892b58a9352c8f5f454bdf5c642e70cfb9c6dea5c76612c8c045cf8b3069dc76d9c4a5
7
+ data.tar.gz: 8069f73a279d069eb52bac167c95ad38e1da1b1a270d5fc28fe6c48a832307980bf509c39f2f12c749904cd689c4cf6b68b5e203a7b88b726c3c682e504f2c2b
@@ -3,6 +3,7 @@ require_relative 'auxiliary_statement/settings'
3
3
  module Torque
4
4
  module PostgreSQL
5
5
  class AuxiliaryStatement
6
+ TABLE_COLUMN_AS_STRING = /\A(?:"?(\w+)"?\.)?"?(\w+)"?\z/.freeze
6
7
 
7
8
  class << self
8
9
  # These attributes require that the class is setup
@@ -82,9 +83,9 @@ module Torque
82
83
  def project(column, arel_table = nil)
83
84
  if column.respond_to?(:as)
84
85
  return column
85
- elsif column.to_s.include?('.')
86
- table_name, column = column.to_s.split('.')
87
- arel_table = ::Arel::Table.new(table_name)
86
+ elsif (as_string = TABLE_COLUMN_AS_STRING.match(column.to_s))
87
+ column = as_string[2]
88
+ arel_table = ::Arel::Table.new(as_string[1]) unless as_string[1].nil?
88
89
  end
89
90
 
90
91
  arel_table ||= table
@@ -1,5 +1,5 @@
1
1
  module Torque
2
2
  module PostgreSQL
3
- VERSION = '0.1.3'
3
+ VERSION = '0.1.4'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: torque-postgresql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Silva
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-17 00:00:00.000000000 Z
11
+ date: 2018-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails