Class: Dynamoid::Criteria::NonexistentFieldsDetector

Inherits:
Object
  • Object
show all
Defined in:
lib/dynamoid/criteria/nonexistent_fields_detector.rb

Instance Method Summary collapse

Constructor Details

#initialize(conditions, source) ⇒ NonexistentFieldsDetector

Returns a new instance of NonexistentFieldsDetector.



7
8
9
10
11
# File 'lib/dynamoid/criteria/nonexistent_fields_detector.rb', line 7

def initialize(conditions, source)
  @conditions = conditions
  @source = source
  @nonexistent_fields = nonexistent_fields
end

Instance Method Details

#found?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/dynamoid/criteria/nonexistent_fields_detector.rb', line 13

def found?
  @nonexistent_fields.present?
end

#warning_messageObject



17
18
19
20
21
22
23
24
25
# File 'lib/dynamoid/criteria/nonexistent_fields_detector.rb', line 17

def warning_message
  return unless found?

  fields_list = @nonexistent_fields.map { |s| "`#{s}`" }.join(', ')
  count = @nonexistent_fields.size

  'where conditions contain nonexistent' \
    " field #{'name'.pluralize(count)} #{fields_list}"
end