class Dynamoid::Criteria::NonexistentFieldsDetector
@private
Public Class Methods
new(conditions, source)
click to toggle source
# File lib/dynamoid/criteria/nonexistent_fields_detector.rb, line 7 def initialize(conditions, source) @conditions = conditions @source = source @nonexistent_fields = nonexistent_fields end
Public Instance Methods
found?()
click to toggle source
# File lib/dynamoid/criteria/nonexistent_fields_detector.rb, line 13 def found? @nonexistent_fields.present? end
warning_message()
click to toggle source
# 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
Private Instance Methods
fields_existent()
click to toggle source
# File lib/dynamoid/criteria/nonexistent_fields_detector.rb, line 37 def fields_existent @source.attributes.keys.map(&:to_sym) end
fields_from_conditions()
click to toggle source
# File lib/dynamoid/criteria/nonexistent_fields_detector.rb, line 33 def fields_from_conditions @conditions.keys.map { |s| s.to_s.split('.')[0].to_sym } end
nonexistent_fields()
click to toggle source
# File lib/dynamoid/criteria/nonexistent_fields_detector.rb, line 29 def nonexistent_fields fields_from_conditions - fields_existent end