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

#dumped_value, #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:



570
571
572
573
574
575
576
577
578
579
# File 'lib/dm-core/query/conditions/comparison.rb', line 570

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