nobrainer 0.18.0 → 0.19.0

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.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/lib/no_brainer/config.rb +35 -37
  3. data/lib/no_brainer/connection.rb +1 -1
  4. data/lib/no_brainer/criteria/after_find.rb +3 -11
  5. data/lib/no_brainer/criteria/cache.rb +7 -7
  6. data/lib/no_brainer/criteria/core.rb +49 -10
  7. data/lib/no_brainer/criteria/delete.rb +1 -1
  8. data/lib/no_brainer/criteria/extend.rb +4 -16
  9. data/lib/no_brainer/criteria/index.rb +7 -13
  10. data/lib/no_brainer/criteria/limit.rb +5 -12
  11. data/lib/no_brainer/criteria/order_by.rb +19 -35
  12. data/lib/no_brainer/criteria/pluck.rb +16 -22
  13. data/lib/no_brainer/criteria/preload.rb +9 -15
  14. data/lib/no_brainer/criteria/raw.rb +4 -10
  15. data/lib/no_brainer/criteria/scope.rb +4 -10
  16. data/lib/no_brainer/criteria/where.rb +172 -130
  17. data/lib/no_brainer/document/aliases.rb +10 -2
  18. data/lib/no_brainer/document/association/belongs_to.rb +3 -3
  19. data/lib/no_brainer/document/association/core.rb +1 -1
  20. data/lib/no_brainer/document/association/eager_loader.rb +4 -3
  21. data/lib/no_brainer/document/association/has_many.rb +2 -2
  22. data/lib/no_brainer/document/atomic_ops.rb +29 -30
  23. data/lib/no_brainer/document/attributes.rb +15 -19
  24. data/lib/no_brainer/document/callbacks.rb +1 -1
  25. data/lib/no_brainer/document/id.rb +7 -3
  26. data/lib/no_brainer/document/index.rb +20 -10
  27. data/lib/no_brainer/document/persistance.rb +11 -10
  28. data/lib/no_brainer/document/timestamps.rb +4 -2
  29. data/lib/no_brainer/document/types/binary.rb +0 -1
  30. data/lib/no_brainer/document/types/boolean.rb +0 -1
  31. data/lib/no_brainer/document/types.rb +0 -9
  32. data/lib/no_brainer/document/uniqueness.rb +0 -1
  33. data/lib/no_brainer/document/validation.rb +5 -5
  34. data/lib/no_brainer/error.rb +1 -0
  35. data/lib/no_brainer/query_runner/connection_lock.rb +1 -1
  36. data/lib/no_brainer/query_runner/reconnect.rb +9 -11
  37. data/lib/no_brainer/query_runner/table_on_demand.rb +1 -1
  38. data/lib/no_brainer/railtie/database.rake +2 -2
  39. data/lib/no_brainer/rql.rb +1 -1
  40. data/lib/nobrainer.rb +1 -6
  41. data/lib/rails/generators/nobrainer.rb +1 -1
  42. metadata +18 -5
  43. data/lib/no_brainer/decorated_symbol.rb +0 -17
@@ -2,54 +2,53 @@ module NoBrainer::Document::AtomicOps
2
2
  extend ActiveSupport::Concern
3
3
 
4
4
  class PendingAtomic
5
- def self._new(instance, field, value, is_user_value, options={})
6
- model = case value
7
- when Array then PendingAtomicArray
8
- when Set then PendingAtomicSet
9
- else self
10
- end
11
- model.new(instance, field, value, is_user_value, options)
5
+ def self._new(instance, field, value, is_user_value)
6
+ case value
7
+ when Array then PendingAtomicArray
8
+ when Set then PendingAtomicSet
9
+ else self
10
+ end.new(instance, field, value, is_user_value)
12
11
  end
13
12
 
14
- def initialize(instance, field, value, is_user_value, options={})
13
+ def initialize(instance, field, value, is_user_value)
15
14
  @instance = instance
16
15
  @field = field.to_s
17
16
  @value = value
18
17
  @is_user_value = is_user_value
19
- @options = options.dup
20
18
  @ops = []
21
19
  end
22
20
 
23
- def write_access?
24
- !!@options[:write_access]
25
- end
26
-
27
- def ensure_writeable!
28
- unless write_access?
29
- @options[:write_access] = true
30
- @instance.write_attribute(@field, self)
31
- end
21
+ def initialize_copy(other)
22
+ super
23
+ @ops = @ops.dup
32
24
  end
33
25
 
34
26
  def to_s
35
- "<#{@field} with pending atomic operations>"
27
+ "<`#{@field}' with #{@ops.size} pending atomic operations>"
36
28
  end
37
- alias inspect to_s
29
+ alias_method :inspect, :to_s
38
30
 
39
- def method_missing(method_name, *a, &b)
40
- @ops << [method_name, a, b]
31
+ def method_missing(method, *a, &b)
32
+ @ops << [method, a, b]
41
33
  self
42
34
  end
43
35
 
44
36
  def compile_rql_value(rql_doc)
45
37
  field = @instance.class.lookup_field_alias(@field)
46
38
  value = @is_user_value ? RethinkDB::RQL.new.expr(@value) : rql_doc[field]
47
- @ops.each { |method_name, a, b| value = value.__send__(method_name, *a, &b) }
48
- value
39
+ @ops.reduce(value) { |v, (method, a, b)| v.__send__(method, *a, &b) }
40
+ end
41
+ end
42
+
43
+ class PendingAtomicContainer < PendingAtomic
44
+ def modify_source!
45
+ unless @instance._is_attribute_touched?(@field)
46
+ @instance.write_attribute(@field, self)
47
+ end
49
48
  end
50
49
  end
51
50
 
52
- class PendingAtomicArray < PendingAtomic
51
+ class PendingAtomicArray < PendingAtomicContainer
53
52
  def -(value)
54
53
  @ops << [:difference, [value.to_a]]
55
54
  self
@@ -80,12 +79,12 @@ module NoBrainer::Document::AtomicOps
80
79
 
81
80
  def <<(value)
82
81
  @ops << [:append, [value]]
83
- ensure_writeable!
82
+ modify_source!
84
83
  self
85
84
  end
86
85
  end
87
86
 
88
- class PendingAtomicSet < PendingAtomicArray
87
+ class PendingAtomicSet < PendingAtomicContainer
89
88
  def -(value)
90
89
  @ops << [:set_difference, [value.to_a]]
91
90
  self
@@ -98,7 +97,7 @@ module NoBrainer::Document::AtomicOps
98
97
 
99
98
  def <<(value)
100
99
  @ops << [:set_union, [[value]]]
101
- ensure_writeable!
100
+ modify_source!
102
101
  self
103
102
  end
104
103
  end
@@ -145,9 +144,9 @@ module NoBrainer::Document::AtomicOps
145
144
  value = super
146
145
 
147
146
  case [in_atomic?, value.is_a?(PendingAtomic)]
148
- when [true, true] then value
149
147
  when [true, false] then PendingAtomic._new(self, name, value, _is_attribute_touched?(name))
150
148
  when [false, true] then raise NoBrainer::Error::CannotReadAtomic.new(self, name, value)
149
+ when [true, true] then value.is_a?(PendingAtomicContainer) ? value : value.dup
151
150
  when [false, false] then value
152
151
  end
153
152
  end
@@ -156,9 +155,9 @@ module NoBrainer::Document::AtomicOps
156
155
  ensure_exclusive_atomic!
157
156
 
158
157
  case [in_atomic?, value.is_a?(PendingAtomic)]
159
- when [true, true] then super
160
158
  when [true, false] then raise NoBrainer::Error::AtomicBlock.new('Avoid the use of atomic blocks for non atomic operations')
161
159
  when [false, true] then raise NoBrainer::Error::AtomicBlock.new('Use atomic blocks for atomic operations')
160
+ when [true, true] then super.tap { _touch_attribute(name) }
162
161
  when [false, false] then super.tap { _touch_attribute(name) }
163
162
  end
164
163
  end
@@ -1,14 +1,11 @@
1
1
  module NoBrainer::Document::Attributes
2
- VALID_FIELD_OPTIONS = [:index, :default, :type, :real_type,
3
- :validates, :required, :unique, :uniq, :format, :in,
4
- :readonly, :primary_key, :as, :lazy_fetch]
2
+ VALID_FIELD_OPTIONS = [:index, :default, :type, :readonly, :primary_key, :lazy_fetch, :store_as,
3
+ :validates, :required, :unique, :uniq, :format, :in]
5
4
  RESERVED_FIELD_NAMES = [:index, :default, :and, :or, :selector, :associations, :pk_value] \
6
- + NoBrainer::DecoratedSymbol::MODIFIERS.keys
5
+ + NoBrainer::Criteria::Where::OPERATORS
7
6
  extend ActiveSupport::Concern
8
7
 
9
8
  included do
10
- # Not using class_attribute because we want to
11
- # use our custom logic
12
9
  singleton_class.send(:attr_accessor, :fields)
13
10
  self.fields = {}
14
11
  end
@@ -46,20 +43,19 @@ module NoBrainer::Document::Attributes
46
43
 
47
44
  def assign_defaults(options)
48
45
  self.class.fields.each do |name, field_options|
49
- if field_options.has_key?(:default) &&
50
- !@_attributes.has_key?(name)
51
-
52
- if opt = options[:missing_attributes]
53
- if (opt[:pluck] && !opt[:pluck][name]) ||
54
- (opt[:without] && opt[:without][name])
55
- next
56
- end
57
- end
58
-
59
- default_value = field_options[:default]
60
- default_value = default_value.call if default_value.is_a?(Proc)
61
- self.write_attribute(name, default_value)
46
+ next unless field_options.has_key?(:default) &&
47
+ !@_attributes.has_key?(name)
48
+
49
+ if opt = options[:missing_attributes]
50
+ if (opt[:pluck] && !opt[:pluck][name]) ||
51
+ (opt[:without] && opt[:without][name])
52
+ next
53
+ end
62
54
  end
55
+
56
+ default_value = field_options[:default]
57
+ default_value = default_value.call if default_value.is_a?(Proc)
58
+ self.write_attribute(name, default_value)
63
59
  end
64
60
  end
65
61
 
@@ -9,7 +9,7 @@ module NoBrainer::Document::Callbacks
9
9
  end
10
10
 
11
11
  def initialize(*args, &block)
12
- run_callbacks(:initialize) { _initialize(*args); true }
12
+ run_callbacks(:initialize) { _initialize(*args, &block); true }
13
13
  end
14
14
 
15
15
  def _create(*args, &block)
@@ -51,14 +51,13 @@ module NoBrainer::Document::Id
51
51
  # 3 bytes inc
52
52
  oid += [get_inc].pack("N")[1, 3]
53
53
 
54
- oid.unpack("C12").map {|e| v=e.to_s(16); v.size == 1 ? "0#{v}" : v }.join
54
+ oid.unpack("C12").map { |e| v = e.to_s(16); v.size == 1 ? "0#{v}" : v }.join
55
55
  end
56
56
 
57
57
  module ClassMethods
58
58
  def define_default_pk
59
59
  class_variable_set(:@@pk_name, nil)
60
- field NoBrainer::Document::Id::DEFAULT_PK_NAME, :primary_key => :default,
61
- :type => String, :default => ->{ NoBrainer::Document::Id.generate }
60
+ field NoBrainer::Document::Id::DEFAULT_PK_NAME, :primary_key => :default
62
61
  end
63
62
 
64
63
  def define_pk(attr)
@@ -81,6 +80,11 @@ module NoBrainer::Document::Id
81
80
  if options[:primary_key]
82
81
  options = options.merge(:readonly => true) if options[:readonly].nil?
83
82
  options = options.merge(:index => true)
83
+
84
+ if options[:type].in?([String, nil]) && options[:default].nil?
85
+ options[:type] = String
86
+ options[:default] = ->{ NoBrainer::Document::Id.generate }
87
+ end
84
88
  end
85
89
  super
86
90
  end
@@ -1,5 +1,5 @@
1
1
  module NoBrainer::Document::Index
2
- VALID_INDEX_OPTIONS = [:external, :geo, :multi, :as]
2
+ VALID_INDEX_OPTIONS = [:external, :geo, :multi, :store_as]
3
3
  extend ActiveSupport::Concern
4
4
  extend NoBrainer::Autoload
5
5
 
@@ -14,6 +14,12 @@ module NoBrainer::Document::Index
14
14
  def index(name, *args)
15
15
  name = name.to_sym
16
16
  options = args.extract_options!
17
+
18
+ if options[:as]
19
+ STDERR.puts "[NoBrainer] `:as' is deprecated and will be removed. Please use `:store_as' instead (from the #{self} model)"
20
+ options[:store_as] = options.delete(:as)
21
+ end
22
+
17
23
  options.assert_valid_keys(*VALID_INDEX_OPTIONS)
18
24
 
19
25
  raise "Too many arguments: #{args}" if args.size > 1
@@ -33,12 +39,16 @@ module NoBrainer::Document::Index
33
39
  raise "Cannot reuse field name #{name}"
34
40
  end
35
41
 
36
- as = options.delete(:as)
37
- as ||= fields[name][:as] if has_field?(name)
38
- as ||= name
39
- as = as.to_sym
42
+ if kind == :compound && what.size < 2
43
+ raise "Compound indexes only make sense with 2 or more fields"
44
+ end
45
+
46
+ store_as = options.delete(:store_as)
47
+ store_as ||= fields[name][:store_as] if has_field?(name)
48
+ store_as ||= name
49
+ store_as = store_as.to_sym
40
50
 
41
- indexes[name] = NoBrainer::Document::Index::Index.new(self.root_class, name, as,
51
+ indexes[name] = NoBrainer::Document::Index::Index.new(self.root_class, name, store_as,
42
52
  kind, what, options[:external], options[:geo], options[:multi], nil)
43
53
  end
44
54
 
@@ -57,12 +67,12 @@ module NoBrainer::Document::Index
57
67
 
58
68
  super
59
69
 
60
- as = {:as => options[:as]}
70
+ store_as = {:store_as => options[:store_as]}
61
71
  case options[:index]
62
72
  when nil then
63
- when Hash then index(attr, as.merge(options[:index]))
64
- when Symbol then index(attr, as.merge(options[:index] => true))
65
- when true then index(attr, as)
73
+ when Hash then index(attr, store_as.merge(options[:index]))
74
+ when Symbol then index(attr, store_as.merge(options[:index] => true))
75
+ when true then index(attr, store_as)
66
76
  when false then remove_index(attr)
67
77
  end
68
78
  end
@@ -45,16 +45,16 @@ module NoBrainer::Document::Persistance
45
45
 
46
46
  def reload(options={})
47
47
  [:without, :pluck].each do |type|
48
- if v = options.delete(type)
49
- v = Hash[v.flatten.map { |k| [k, true] }] if v.is_a?(Array)
50
- v = {v => true} if !v.is_a?(Hash)
51
- v = v.select { |k,_v| _v }
52
- v = v.with_indifferent_access
53
- next unless v.present?
54
-
55
- options[:missing_attributes] ||= {}
56
- options[:missing_attributes][type] = v
57
- end
48
+ next unless v = options.delete(type)
49
+
50
+ v = Hash[v.flatten.map { |k| [k, true] }] if v.is_a?(Array)
51
+ v = {v => true} unless v.is_a?(Hash)
52
+ v = v.select { |k,_v| _v }
53
+ v = v.with_indifferent_access
54
+ next unless v.present?
55
+
56
+ options[:missing_attributes] ||= {}
57
+ options[:missing_attributes][type] = v
58
58
  end
59
59
  _reload(options)
60
60
  end
@@ -144,6 +144,7 @@ module NoBrainer::Document::Persistance
144
144
  def create(attrs={}, options={})
145
145
  new(attrs, options).tap { |doc| doc.save(options) }
146
146
  end
147
+ alias_method :create!, :create
147
148
 
148
149
  def insert_all(*args)
149
150
  docs = args.shift
@@ -7,12 +7,14 @@ module NoBrainer::Document::Timestamps
7
7
  end
8
8
 
9
9
  def _create(options={})
10
- self.created_at = self.updated_at = Time.now
10
+ now = Time.now
11
+ self.created_at = now unless created_at_changed?
12
+ self.updated_at = now unless updated_at_changed?
11
13
  super
12
14
  end
13
15
 
14
16
  def _update(attrs)
15
- self.updated_at = Time.now
17
+ self.updated_at = Time.now unless updated_at_changed?
16
18
  super(attrs.merge('updated_at' => @_attributes['updated_at']))
17
19
  end
18
20
  end
@@ -20,4 +20,3 @@ class NoBrainer::Binary
20
20
  end
21
21
  extend NoBrainerExtentions
22
22
  end
23
-
@@ -23,4 +23,3 @@ class NoBrainer::Boolean
23
23
  end
24
24
  extend NoBrainerExtentions
25
25
  end
26
-
@@ -88,15 +88,6 @@ module NoBrainer::Document::Types
88
88
  remove_method("#{attr}?") if method_defined?("#{attr}?")
89
89
  end
90
90
  end
91
-
92
- def field(attr, options={})
93
- options[:real_type] = options[:type]
94
- if options[:type] == Array || options[:type] == Hash
95
- # XXX For the moment, NoBrainer does not support these complex types
96
- options.delete(:type)
97
- end
98
- super
99
- end
100
91
  end
101
92
 
102
93
  require File.join(File.dirname(__FILE__), 'types', 'binary')
@@ -58,7 +58,6 @@ module NoBrainer::Document::Uniqueness
58
58
  subclass.unique_validators = self.unique_validators.dup
59
59
  super
60
60
  end
61
-
62
61
  end
63
62
 
64
63
  class UniquenessValidator < ActiveModel::EachValidator
@@ -23,11 +23,11 @@ module NoBrainer::Document::Validation
23
23
  module ClassMethods
24
24
  def _field(attr, options={})
25
25
  super
26
- validates(attr, { :format => { :with => options[:format] } }) if options.has_key?(:format)
27
- validates(attr, { :presence => options[:required] }) if options.has_key?(:required)
28
- validates(attr, { :uniqueness => options[:unique] }) if options.has_key?(:unique)
29
- validates(attr, { :uniqueness => options[:uniq] }) if options.has_key?(:uniq)
30
- validates(attr, { :inclusion => {:in => options[:in]} }) if options.has_key?(:in)
26
+ validates(attr, :format => { :with => options[:format] }) if options.has_key?(:format)
27
+ validates(attr, :presence => options[:required]) if options.has_key?(:required)
28
+ validates(attr, :uniqueness => options[:unique]) if options.has_key?(:unique)
29
+ validates(attr, :uniqueness => options[:uniq]) if options.has_key?(:uniq)
30
+ validates(attr, :inclusion => {:in => options[:in]}) if options.has_key?(:in)
31
31
  validates(attr, options[:validates]) if options[:validates]
32
32
  end
33
33
  end
@@ -9,6 +9,7 @@ module NoBrainer::Error
9
9
  class AssociationNotPersisted < RuntimeError; end
10
10
  class ReadonlyField < RuntimeError; end
11
11
  class MissingAttribute < RuntimeError; end
12
+ class UnknownAttribute < RuntimeError; end
12
13
  class AtomicBlock < RuntimeError; end
13
14
 
14
15
  class CannotReadAtomic < RuntimeError
@@ -3,7 +3,7 @@ class NoBrainer::QueryRunner::ConnectionLock < NoBrainer::QueryRunner::Middlewar
3
3
 
4
4
  def call(env)
5
5
  if NoBrainer::Config.per_thread_connection
6
- @runner.call(env)
6
+ @runner.call(env)
7
7
  else
8
8
  @@lock.synchronize { @runner.call(env) }
9
9
  end
@@ -18,18 +18,16 @@ class NoBrainer::QueryRunner::Reconnect < NoBrainer::QueryRunner::Middleware
18
18
  private
19
19
 
20
20
  def reconnect(e, context)
21
- begin
22
- return false if context[:retries].zero?
23
- context[:retries] -= 1
21
+ return false if context[:retries].zero?
22
+ context[:retries] -= 1
24
23
 
25
- warn_reconnect(e)
26
- sleep 1
27
- NoBrainer.connection.reconnect(:noreply_wait => false)
28
- return true
29
- rescue StandardError => e
30
- retry if is_connection_error_exception?(e)
31
- raise
32
- end
24
+ warn_reconnect(e)
25
+ sleep 1
26
+ NoBrainer.connection.reconnect(:noreply_wait => false)
27
+ true
28
+ rescue StandardError => e
29
+ retry if is_connection_error_exception?(e)
30
+ raise
33
31
  end
34
32
 
35
33
  def is_connection_error_exception?(e)
@@ -30,7 +30,7 @@ class NoBrainer::QueryRunner::TableOnDemand < NoBrainer::QueryRunner::Middleware
30
30
  env[:last_auto_create_table] = [database_name, table_name]
31
31
 
32
32
  NoBrainer.with_database(database_name) do
33
- NoBrainer.table_create(table_name, :primary_key => model.pk_name)
33
+ NoBrainer.table_create(table_name, :primary_key => model.lookup_field_alias(model.pk_name))
34
34
  end
35
35
  rescue RuntimeError => e
36
36
  # We might have raced with another table create
@@ -19,10 +19,10 @@ namespace :nobrainer do
19
19
  end
20
20
 
21
21
  desc 'Equivalent to :sync_indexes_quiet + :seed'
22
- task :setup => [ :sync_indexes_quiet, :seed ]
22
+ task :setup => [:sync_indexes_quiet, :seed]
23
23
 
24
24
  desc 'Equivalent to :drop + :setup'
25
- task :reset => [ :drop, :setup ]
25
+ task :reset => [:drop, :setup]
26
26
 
27
27
  task :create => :environment do
28
28
  # noop
@@ -19,7 +19,7 @@ module NoBrainer::RQL
19
19
  case rql_query.body.first
20
20
  when UPDATE, DELETE, REPLACE, INSERT
21
21
  :write
22
- when DB_CREATE,DB_DROP, DB_LIST, TABLE_CREATE, TABLE_DROP, TABLE_LIST, SYNC,
22
+ when DB_CREATE, DB_DROP, DB_LIST, TABLE_CREATE, TABLE_DROP, TABLE_LIST, SYNC,
23
23
  INDEX_CREATE, INDEX_DROP, INDEX_LIST, INDEX_STATUS, INDEX_WAIT
24
24
  :management
25
25
  else
data/lib/nobrainer.rb CHANGED
@@ -12,7 +12,7 @@ module NoBrainer
12
12
 
13
13
  # We eager load things that could be loaded when handling the first web request.
14
14
  # Code that is loaded through the DSL of NoBrainer should not be eager loaded.
15
- autoload :Document, :IndexManager, :Loader, :Fork, :DecoratedSymbol
15
+ autoload :Document, :IndexManager, :Loader, :Fork
16
16
  eager_autoload :Config, :Connection, :ConnectionManager, :Error,
17
17
  :QueryRunner, :Criteria, :RQL
18
18
 
@@ -31,13 +31,8 @@ module NoBrainer
31
31
  def jruby?
32
32
  RUBY_PLATFORM == 'java'
33
33
  end
34
-
35
- def user_caller
36
- caller.reject { |s| s =~ /\/no_brainer\// }.first
37
- end
38
34
  end
39
35
 
40
- DecoratedSymbol.hook
41
36
  Fork.hook unless jruby?
42
37
  end
43
38
 
@@ -12,7 +12,7 @@ module NoBrainer::Generators
12
12
  end
13
13
 
14
14
  def self.namespace
15
- super.gsub(/no_brainer/,'nobrainer')
15
+ super.gsub(/no_brainer/, 'nobrainer')
16
16
  end
17
17
  end
18
18
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nobrainer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
4
+ version: 0.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas Viennot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-08 00:00:00.000000000 Z
11
+ date: 2014-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rethinkdb
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.14.0.0
19
+ version: 1.15.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 1.14.0.0
26
+ version: 1.15.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.1.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: symbol_decoration
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.1'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.1'
69
83
  description: ORM for RethinkDB
70
84
  email:
71
85
  - nicolas@viennot.biz
@@ -98,7 +112,6 @@ files:
98
112
  - lib/no_brainer/criteria/scope.rb
99
113
  - lib/no_brainer/criteria/update.rb
100
114
  - lib/no_brainer/criteria/where.rb
101
- - lib/no_brainer/decorated_symbol.rb
102
115
  - lib/no_brainer/document.rb
103
116
  - lib/no_brainer/document/aliases.rb
104
117
  - lib/no_brainer/document/association.rb
@@ -1,17 +0,0 @@
1
- class NoBrainer::DecoratedSymbol < Struct.new(:symbol, :modifier, :args)
2
- MODIFIERS = { :in => :in, :nin => :nin,
3
- :eq => :eq, :ne => :ne, :not => :ne,
4
- :gt => :gt, :ge => :ge, :gte => :ge,
5
- :lt => :lt, :le => :le, :lte => :le,
6
- :defined => :defined }
7
-
8
- def self.hook
9
- Symbol.class_eval do
10
- MODIFIERS.each do |modifier_name, modifier|
11
- define_method modifier_name do |*args|
12
- NoBrainer::DecoratedSymbol.new(self, modifier, args)
13
- end
14
- end
15
- end
16
- end
17
- end