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.



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

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

Instance Method Details

#found?Boolean

Returns:

  • (Boolean)


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

def found?
  @nonexistent_fields.present?
end

#warning_messageObject



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

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