Class: DataMapper::Query::Conditions::InclusionComparison

Inherits:
AbstractComparison show all
Includes:
RelationshipHandler
Defined in:
lib/dm-core/query/conditions/comparison.rb

Overview

Tests whether the value in the record is contained in the expected set for the Comparison, where expected is an Array, Range, or Set.

Instance Attribute Summary

Attributes inherited from AbstractComparison

#loaded_value, #parent, #subject

Instance Method Summary collapse

Methods included from RelationshipHandler

#foreign_key_mapping, #matches?, #relationship?

Methods inherited from AbstractComparison

descendants, inherited, #inspect, #matches?, #negated?, #property?, #relationship?, slug, #slug, #to_s, #value

Methods included from Equalizer

#equalize

Instance Method Details

#valid?Boolean

Checks that the Comparison is valid

Returns:

  • (Boolean)

See Also:



584
585
586
587
588
589
590
591
592
593
# File 'lib/dm-core/query/conditions/comparison.rb', line 584

def valid?
  loaded_value = self.loaded_value
  case loaded_value
    when Collection then valid_collection?(loaded_value)
    when Range      then valid_range?(loaded_value)
    when Enumerable then valid_enumerable?(loaded_value)
    else
      false
  end
end