Module: Mongory
- Defined in:
- lib/mongory.rb,
lib/mongory/rails.rb,
lib/mongory/utils.rb,
lib/mongory/mongoid.rb,
lib/mongory/version.rb,
lib/mongory/matchers.rb,
lib/mongory/c_matcher.rb,
lib/mongory/query_builder.rb,
lib/mongory/query_matcher.rb,
lib/mongory/utils/context.rb,
lib/mongory/query_operator.rb,
lib/mongory/utils/debugger.rb,
lib/mongory/c_query_builder.rb,
lib/mongory/utils/rails_patch.rb,
lib/mongory/matchers/eq_matcher.rb,
lib/mongory/matchers/gt_matcher.rb,
lib/mongory/matchers/in_matcher.rb,
lib/mongory/matchers/lt_matcher.rb,
lib/mongory/matchers/ne_matcher.rb,
lib/mongory/matchers/or_matcher.rb,
lib/mongory/converters/converted.rb,
lib/mongory/matchers/and_matcher.rb,
lib/mongory/matchers/gte_matcher.rb,
lib/mongory/matchers/lte_matcher.rb,
lib/mongory/matchers/nin_matcher.rb,
lib/mongory/matchers/not_matcher.rb,
lib/mongory/matchers/size_matcher.rb,
lib/mongory/matchers/every_matcher.rb,
lib/mongory/matchers/field_matcher.rb,
lib/mongory/matchers/regex_matcher.rb,
lib/mongory/matchers/exists_matcher.rb,
lib/mongory/utils/singleton_builder.rb,
lib/mongory/converters/key_converter.rb,
lib/mongory/matchers/literal_matcher.rb,
lib/mongory/matchers/present_matcher.rb,
lib/mongory/converters/data_converter.rb,
lib/mongory/matchers/abstract_matcher.rb,
lib/mongory/converters/value_converter.rb,
lib/mongory/matchers/elem_match_matcher.rb,
lib/mongory/converters/abstract_converter.rb,
lib/mongory/matchers/array_record_matcher.rb,
lib/mongory/converters/condition_converter.rb,
lib/mongory/matchers/abstract_multi_matcher.rb,
lib/mongory/matchers/hash_condition_matcher.rb,
lib/generators/mongory/install/install_generator.rb,
lib/generators/mongory/matcher/matcher_generator.rb
Overview
Main namespace for Mongory DSL and configuration.
Provides access to core converters, query construction, and optional integrations with frameworks like Rails or Mongoid.
Defined Under Namespace
Modules: ClassExtention, Converters, Generators, Matchers, MongoidPatch, Utils Classes: CMatcher, CQueryBuilder, Error, QueryBuilder, QueryMatcher, QueryOperator, Railtie, TypeError
Constant Summary collapse
- VERSION =
'0.8.1'
Class Method Summary collapse
-
.build_query(records) ⇒ QueryBuilder
Builds a new query over the given record set.
-
.condition_converter ⇒ Converters::ConditionConverter
Returns the condition converter instance.
-
.configure {|self| ... } ⇒ void
Yields Mongory for configuration and freezes key components.
-
.data_converter ⇒ Converters::DataConverter
Returns the data converter instance.
-
.debugger ⇒ Utils::Debugger
Returns the debugger instance.
-
.enable_symbol_snippets! ⇒ void
Enables symbol snippets like
:age.gte
or:name.regex
by dynamically defining methods onSymbol
for query operators. -
.register(klass) ⇒ void
Registers a class to support
.mongory
query DSL.
Class Method Details
.build_query(records) ⇒ QueryBuilder
Builds a new query over the given record set.
83 84 85 |
# File 'lib/mongory.rb', line 83 def self.build_query(records) QueryBuilder.new(records) end |
.condition_converter ⇒ Converters::ConditionConverter
Returns the condition converter instance.
68 69 70 |
# File 'lib/mongory.rb', line 68 def self.condition_converter @condition_converter ||= Converters::ConditionConverter.instance end |
.configure {|self| ... } ⇒ void
This method returns an undefined value.
Yields Mongory for configuration and freezes key components.
51 52 53 54 55 56 |
# File 'lib/mongory.rb', line 51 def self.configure yield self data_converter.freeze condition_converter.freeze Matchers.freeze end |
.data_converter ⇒ Converters::DataConverter
Returns the data converter instance.
61 62 63 |
# File 'lib/mongory.rb', line 61 def self.data_converter @data_converter ||= Converters::DataConverter.instance end |
.debugger ⇒ Utils::Debugger
Returns the debugger instance.
75 76 77 |
# File 'lib/mongory.rb', line 75 def self.debugger @debugger ||= Utils::Debugger.instance end |
.enable_symbol_snippets! ⇒ void
This method returns an undefined value.
Enables symbol snippets like :age.gte
or :name.regex
by dynamically defining methods on Symbol
for query operators.
Skips operators that already exist to avoid patching Mongoid or other gems.
102 103 104 |
# File 'lib/mongory.rb', line 102 def self.enable_symbol_snippets! Matchers.enable_symbol_snippets! end |
.register(klass) ⇒ void
This method returns an undefined value.
Registers a class to support .mongory
query DSL.
This injects a #mongory
method into the given class.
92 93 94 |
# File 'lib/mongory.rb', line 92 def self.register(klass) klass.include(ClassExtention) end |