torque-postgresql 0.1.5 → 0.1.6

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
  SHA1:
3
- metadata.gz: 77d019513db5d70b25fd3489ccbdd7305a11e2ab
4
- data.tar.gz: d12c174d8466de76823f6fb80872bf3fc7303fec
3
+ metadata.gz: 4cc336d84a0f18fb43d39e8bcb62675ec27e4858
4
+ data.tar.gz: 9d379870667fbee69ab9462ecae7264794721c29
5
5
  SHA512:
6
- metadata.gz: 983236df47590d03edd4d0359e7782e10e4e469631f4f92f8808e6c9770d56e886be78d6d35711005d5761a5868ba2123a9fe98200f20f7915692aacacb7b97a
7
- data.tar.gz: 2466995358d6b044ba9af43c52b26bdd861c725ade78dc696ea81283121d17d8efc28feae9098bdfe75dd3c09e3488a56d25f075194aa5f746534f2f42398407
6
+ metadata.gz: fb36ee1d4b3a9bb0577dd78ed856fc2a6de4e5525d5c32d74c071b88ad3cf124b348dbbc776122921f4d9d084b2bd558faf98382ff2b5854b0de93f6a8f1c82a
7
+ data.tar.gz: 5c59b4cace85d923cfcbf01bc4f265f7a192b9f1dd9810d49348706604c554ce4b54bfdb5697d6bbaefebfe38f8adde7684cce255d4c3777516557436b86086a
@@ -9,11 +9,11 @@ module Torque
9
9
  LAZY_VALUE = 0.chr
10
10
 
11
11
  class << self
12
- delegate :each, to: :values
12
+ delegate :each, :sample, to: :values
13
13
 
14
14
  # Find or create the class that will handle the value
15
15
  def lookup(name)
16
- const = name.camelize
16
+ const = name.to_s.camelize
17
17
  namespace = Torque::PostgreSQL.config.enum.namespace
18
18
 
19
19
  return namespace.const_get(const) if namespace.const_defined?(const)
@@ -71,7 +71,7 @@ module Torque
71
71
  # Allow fast creation of values
72
72
  def method_missing(method_name, *arguments)
73
73
  return super if self == Enum
74
- self.valid?(method_name) ? new(method_name.to_s) : super
74
+ valid?(method_name) ? new(method_name.to_s) : super
75
75
  end
76
76
 
77
77
  # Get a connection based on its name
@@ -226,6 +226,10 @@ module Torque
226
226
  # Mark the enum as defined
227
227
  defined_enums[attribute] = subtype.klass
228
228
  end
229
+
230
+ Torque::PostgreSQL.config.enum.namespace.define_singleton_method(:const_missing) do |name|
231
+ Enum.lookup(name)
232
+ end
229
233
  end
230
234
  end
231
235
  end
@@ -3,14 +3,19 @@ module Torque
3
3
  module Base
4
4
  extend ActiveSupport::Concern
5
5
 
6
- included do
7
- class_attribute :auxiliary_statements_list, instance_accessor: true
8
- self.auxiliary_statements_list = {}
9
- end
10
-
11
6
  module ClassMethods
12
7
  delegate :distinct_on, :with, to: :all
13
8
 
9
+ private
10
+
11
+ # Wenever it's inherited, add a new list of auxiliary statements
12
+ def inherited(subclass)
13
+ subclass.class_eval do
14
+ class_attribute :auxiliary_statements_list, instance_accessor: true
15
+ self.auxiliary_statements_list = Hash.new
16
+ end
17
+ end
18
+
14
19
  protected
15
20
 
16
21
  # Creates a new auxiliary statement (CTE) under the base class
@@ -1,5 +1,5 @@
1
1
  module Torque
2
2
  module PostgreSQL
3
- VERSION = '0.1.5'
3
+ VERSION = '0.1.6'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: torque-postgresql
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
  - Carlos Silva