mongory 0.8.0 → 0.8.1

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: ec4fdb883e5af55a20e18cae69b7979c725af694722034e8ce475c455c6d760b
4
- data.tar.gz: 44b66a0bd8c2da577bf6f76078b00ca47d9d727c4b147ba1e976ac80622ec4e9
3
+ metadata.gz: ea774db3304817acd068531393945fc6c812ac00c8d0b47e71f6740bc8792f67
4
+ data.tar.gz: c331c32c9b464249b1e24cac91c2f60bba87065dfe2f48bc5a44faad4bc504b1
5
5
  SHA512:
6
- metadata.gz: 41c1c0c8f475b0efe95de62c37adf0c3e6fc337374fd850d35df87e4ddac49a747f79b984c51177f3155643745d91ec8f1616f6fa7ef7c811a88f90e81612751
7
- data.tar.gz: '0482198e73d1a4439ceb848c8894986ec4aaecc1e15b6de33d47b2267a97d81ff6d398f4cd057bd57b5cf7f81a3e66e60c8455015892b430435419f46ab5acbb'
6
+ metadata.gz: 49764016c348ef886f1e05a0303cb139d793340b20790ef6d8b39328cc8b5621f097ecff587e76b62157d8b6dadf26ef6ab57d6bca6d9dccf9c3e1643e914045
7
+ data.tar.gz: 2e5b5067ee8df7d94778c5e47dc2bd0e3fc8c17e31e958d16b50a8c21d0821cd65f360c42116b30d05d58251e1e30cbba58c1482a5aabb915fec94c8e4a6abea
@@ -25,6 +25,16 @@ users.mongory
25
25
  posts.mongory
26
26
  .where(:tags.elem_match => { :name => 'ruby', :priority.gt => 5 })
27
27
  .where(:comments.every => { :approved => true })
28
+
29
+ # Since Matcher provide `to_proc` method, you could treat Matcher as a block
30
+ matcher = Mongory::QueryMatcher.new({
31
+ :tags.elem_match => { :name => 'ruby', :priority.gt => 5 },
32
+ :comments.every => { :approved => true }
33
+ })
34
+
35
+ # Will filter
36
+ posts_1.select!(&matcher)
37
+ posts_2.select!(&matcher)
28
38
  ```
29
39
 
30
40
  ## Integration with ActiveRecord
@@ -10,9 +10,13 @@ module Mongory
10
10
  # collection.mongory.c.where(condition).to_a
11
11
  class CMatcher
12
12
  # @!method self.new(condition)
13
- # @param condition [Object] the condition
13
+ # @param condition [Hash] the condition
14
14
  # @return [Mongory::CMatcher] a new matcher
15
15
  # @note This method is implemented in the C extension
16
+ # @!method self.trace_result_colorful=(colorful)
17
+ # @param colorful [Boolean] whether to enable colorful trace result
18
+ # @return [void]
19
+ # @note This method is implemented in the C extension
16
20
  #
17
21
  # @!method match?(record)
18
22
  # @param record [Object] the record to match against
@@ -20,7 +24,7 @@ module Mongory
20
24
  # @note This method is implemented in the C extension
21
25
  # @!method explain
22
26
  # @return [void]
23
- # @note This method will print metcher tree structure
27
+ # @note This method will print matcher tree structure
24
28
  # @note This method is implemented in the C extension
25
29
  # @!method trace
26
30
  # @return [Boolean] true if the record matches the condition, false otherwise
@@ -39,15 +43,11 @@ module Mongory
39
43
  # @note This method will print trace result
40
44
  # @note This method is implemented in the C extension
41
45
  # @!method condition
42
- # @return [Object] the condition
46
+ # @return [Hash] the condition
43
47
  # @note This method is implemented in the C extension
44
48
  # @!method context
45
49
  # @return [Utils::Context] the context
46
50
  # @note This method is implemented in the C extension
47
- # @!method trace_result_colorful=
48
- # @param colorful [Boolean] whether to enable colorful trace result
49
- # @return [Boolean]
50
- # @note This method is implemented in the C extension
51
51
 
52
52
  # @return [Proc] a Proc that performs the matching operation
53
53
  def to_proc
@@ -55,10 +55,16 @@ module Mongory
55
55
  # Iterates through all records that match the current matcher.
56
56
  # Uses a compiled Proc for faster matching.
57
57
  #
58
+ # @deprecated
59
+ # Since C extension has implemented, the fast mode is no longer needed. Use C extension instead.
60
+ #
61
+ # This method is deprecated and will be removed in future versions.
62
+ #
58
63
  # @yieldparam record [Object] each matching record
59
64
  # @return [Enumerator] if no block given
60
65
  # @return [void] if block given
61
66
  def fast
67
+ warn('Deprecated: Since C extension has implemented, the fast mode is no longer needed. Use C extension instead.')
62
68
  return to_enum(:fast) unless block_given?
63
69
 
64
70
  @context.need_convert = false
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mongory
4
- VERSION = '0.8.0'
4
+ VERSION = '0.8.1'
5
5
  end
data/lib/mongory.rb CHANGED
@@ -118,7 +118,7 @@ end
118
118
 
119
119
  begin
120
120
  abi = RUBY_VERSION.split('.').first(2).join('.')
121
- require "core/#{abi}/mongory_ext"
121
+ require_relative "core/#{abi}/mongory_ext"
122
122
  require_relative 'mongory/c_query_builder'
123
123
  require_relative 'mongory/c_matcher'
124
124
  rescue LoadError => e
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongory
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - koten0224