Class: Dynamoid::Criteria::KeyFieldsDetector::Query
- Inherits:
-
Object
- Object
- Dynamoid::Criteria::KeyFieldsDetector::Query
- Defined in:
- lib/dynamoid/criteria/key_fields_detector.rb
Instance Method Summary collapse
- #contain?(field_name) ⇒ Boolean
- #contain_only?(field_names) ⇒ Boolean
- #contain_with_eq_operator?(field_name) ⇒ Boolean
-
#initialize(where_conditions) ⇒ Query
constructor
A new instance of Query.
Constructor Details
#initialize(where_conditions) ⇒ Query
Returns a new instance of Query.
8 9 10 11 12 |
# File 'lib/dynamoid/criteria/key_fields_detector.rb', line 8 def initialize(where_conditions) @where_conditions = where_conditions @fields_with_operator = where_conditions.keys.map(&:to_s) @fields = where_conditions.keys.map(&:to_s).map { |s| s.split('.').first } end |
Instance Method Details
#contain?(field_name) ⇒ Boolean
18 19 20 |
# File 'lib/dynamoid/criteria/key_fields_detector.rb', line 18 def contain?(field_name) @fields.include?(field_name.to_s) end |
#contain_only?(field_names) ⇒ Boolean
14 15 16 |
# File 'lib/dynamoid/criteria/key_fields_detector.rb', line 14 def contain_only?(field_names) (@fields - field_names.map(&:to_s)).blank? end |
#contain_with_eq_operator?(field_name) ⇒ Boolean
22 23 24 |
# File 'lib/dynamoid/criteria/key_fields_detector.rb', line 22 def contain_with_eq_operator?(field_name) @fields_with_operator.include?(field_name.to_s) end |